Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Input): update error color #4428

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/core/src/BaseInput/BaseInput.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ export const { staticClasses, useClasses } = createClasses("HvBaseInput", {
invalid: {
"&:not(.disabled)": {
"& $inputBorderContainer": {
backgroundColor: theme.colors.negative,
backgroundColor: theme.colors.negative_120,
},

"&:hover $inputBorderContainer": {
backgroundColor: theme.colors.negative,
backgroundColor: theme.colors.negative_120,
},

"& $inputRootMultiline": {
"& $input": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
},

"&:hover $inputRootMultiline": {
"& $input": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
},

"&:focus-within $inputRootMultiline": {
"& $input": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
},
},
Expand Down Expand Up @@ -122,7 +122,7 @@ export const { staticClasses, useClasses } = createClasses("HvBaseInput", {
left: "2px",
backgroundColor: theme.colors.atmo4,
},
inputRootInvalid: { borderColor: theme.colors.negative },
inputRootInvalid: { borderColor: theme.colors.negative_120 },
inputRootReadOnly: {
borderColor: theme.colors.secondary_60,
backgroundColor: theme.colors.atmo2,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/CheckBox/CheckBox.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const { staticClasses, useClasses } = createClasses("HvCheckBox", {
},
},
invalidContainer: {
borderBottom: `1px solid ${theme.colors.negative}`,
borderBottom: `1px solid ${theme.colors.negative_120}`,

"&:hover": {
borderBottomLeftRadius: "0px",
Expand All @@ -42,7 +42,7 @@ export const { staticClasses, useClasses } = createClasses("HvCheckBox", {
},
checkbox: { height: "32px" },
invalidCheckbox: {
borderBottom: `1px solid ${theme.colors.negative}`,
borderBottom: `1px solid ${theme.colors.negative_120}`,
borderBottomLeftRadius: "0px",
borderBottomRightRadius: "0px",
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/CheckBoxGroup/CheckBoxGroup.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const { staticClasses, useClasses } = createClasses("HvCheckBoxGroup", {
},
invalid: {
paddingBottom: theme.space.xs,
borderBottom: `1px solid ${theme.colors.negative}`,
borderBottom: `1px solid ${theme.colors.negative_120}`,
},
selectAll: {},
error: {},
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/DatePicker/DatePicker.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export const { staticClasses, useClasses } = createClasses("HvDatePicker", {
panel: {},

dropdownHeaderInvalid: {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
"&:hover": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
},
dropdownHeaderOpen: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Dropdown/Dropdown.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const { staticClasses, useClasses } = createClasses("HvDropdown", {
borderRadius: theme.radii.base,

"& $dropdownHeaderInvalid": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
},
arrow: {},
Expand Down
10 changes: 7 additions & 3 deletions packages/core/src/Forms/WarningText/WarningText.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

export const { staticClasses, useClasses } = createClasses("HvWarningText", {
root: { display: "none" },
root: {
display: "none",
color: theme.colors.negative_120,
},
defaultIcon: { minWidth: "24px", width: "24px", height: "24px" },
warningText: {
color: theme.colors.negative_120,
...theme.typography.caption1,
color: "inherit",
paddingRight: theme.space.xs,
},
show: { display: "flex" },
Expand All @@ -19,5 +23,5 @@ export const { staticClasses, useClasses } = createClasses("HvWarningText", {
margin: 0,
overflow: "hidden",
},
topBorder: { borderTop: `solid 1px ${theme.colors.negative}` },
topBorder: { borderTop: "1px solid currentcolor" },
});
33 changes: 15 additions & 18 deletions packages/core/src/Forms/WarningText/WarningText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@hitachivantara/uikit-react-utils";

import { HvBaseProps } from "../../types/generic";
import { HvTypography } from "../../Typography";
import { setId } from "../../utils/setId";
import { HvFormElementContext } from "../FormElement";
import { staticClasses, useClasses } from "./WarningText.styles";
Expand Down Expand Up @@ -40,12 +39,12 @@ export interface HvWarningTextProps extends HvBaseProps {
export const HvWarningText = (props: HvWarningTextProps) => {
const {
children,
adornment,
isVisible,
adornment: adornmentProp,
isVisible: isVisibleProp,
classes: classesProp,
className,
id,
disabled,
id: idProp,
disabled: disabledProp,
disableGutter = false,
disableBorder = false,
disableAdornment = false,
Expand All @@ -57,13 +56,12 @@ export const HvWarningText = (props: HvWarningTextProps) => {

const { elementId, elementStatus, elementDisabled } =
useContext(HvFormElementContext);
const localDisabled = disabled || elementDisabled;
const localVisible = isVisible ?? elementStatus === "invalid";
const localId = id ?? setId(elementId, "error");
const showWarning = localVisible && !localDisabled;
const content = showWarning ? children : "";
const localAdornment = adornment || (
<Fail iconSize="XS" className={classes.defaultIcon} color="negative" />
const disabled = disabledProp || elementDisabled;
const visible = isVisibleProp ?? elementStatus === "invalid";
const id = idProp ?? setId(elementId, "error");
const showWarning = visible && !disabled;
const adornment = adornmentProp || (
<Fail size="xs" className={classes.defaultIcon} />
);

return (
Expand All @@ -77,21 +75,20 @@ export const HvWarningText = (props: HvWarningTextProps) => {
className,
)}
>
{!disableAdornment && localAdornment}
<HvTypography
id={localId}
{!disableAdornment && adornment}
<span
id={id}
className={cx(classes.warningText, {
[classes.topGutter]: !disableGutter,
[classes.hideText]: hideText,
})}
variant="caption1"
role="status"
aria-live="polite"
aria-relevant="additions text"
{...others}
>
{showWarning && content}
</HvTypography>
{showWarning && children}
</span>
</div>
);
};
4 changes: 2 additions & 2 deletions packages/core/src/Radio/Radio.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const { staticClasses, useClasses } = createClasses("HvRadio", {
},
},
invalidContainer: {
borderBottom: `1px solid ${theme.colors.negative}`,
borderBottom: `1px solid ${theme.colors.negative_120}`,

"&:hover": {
borderBottomLeftRadius: "0px",
Expand All @@ -41,7 +41,7 @@ export const { staticClasses, useClasses } = createClasses("HvRadio", {
},
},
invalidRadio: {
borderBottom: `1px solid ${theme.colors.negative}`,
borderBottom: `1px solid ${theme.colors.negative_120}`,

"&:hover": {
borderBottomLeftRadius: "0px",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/RadioGroup/RadioGroup.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const { staticClasses, useClasses } = createClasses("HvRadioGroup", {
},
invalid: {
paddingBottom: theme.space.xs,
borderBottom: `1px solid ${theme.colors.negative}`,
borderBottom: `1px solid ${theme.colors.negative_120}`,
},
error: {},
});
2 changes: 1 addition & 1 deletion packages/core/src/Select/Select.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const { staticClasses, useClasses } = createClasses("HvSelect", {
disabled: {},
readOnly: {},
invalid: {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
labelContainer: {
display: "flex",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/SelectionList/SelectionList.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ export const { staticClasses, useClasses } = createClasses("HvSelectionList", {
zIndex: 1,
},
},
invalid: { borderBottom: `1px solid ${theme.colors.negative}` },
invalid: { borderBottom: `1px solid ${theme.colors.negative_120}` },
});
2 changes: 1 addition & 1 deletion packages/core/src/Switch/Switch.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export const { staticClasses, useClasses } = createClasses("HvSwitch", {
},
invalidSwitch: {
paddingBottom: "1px",
borderBottom: `1px solid ${theme.colors.negative}`,
borderBottom: `1px solid ${theme.colors.negative_120}`,
},
});
4 changes: 2 additions & 2 deletions packages/core/src/TagsInput/TagsInput.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ export const { staticClasses, useClasses } = createClasses("HvTagsInput", {
},

"&$error": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},

"&$invalid": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
},
tagInputContainerRoot: {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/TimePicker/TimePicker.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export const { useClasses, staticClasses } = createClasses("HvTimePicker", {
dropdownHeader: {},
dropdownHeaderOpen: {},
dropdownHeaderInvalid: {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
"&:hover": {
border: `1px solid ${theme.colors.negative}`,
border: `1px solid ${theme.colors.negative_120}`,
},
},
dropdownPanel: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/styles/src/themes/ds3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ const ds3 = makeTheme((theme) => ({
classes: {
warningText: {
...theme.typography.body,
color: theme.colors.negative,
color: "inherit",
},
topGutter: { paddingTop: "8px" },
defaultIcon: {
Expand Down