diff --git a/package.json b/package.json index d28b06497..5844b5afe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@netdata/netdata-ui", - "version": "4.3.6", + "version": "4.3.7", "description": "netdata UI kit", "main": "dist/index.js", "module": "dist/es6/index.js", diff --git a/src/components/input/input.js b/src/components/input/input.js index 9a12f4688..b0ea557e0 100644 --- a/src/components/input/input.js +++ b/src/components/input/input.js @@ -3,6 +3,16 @@ import Flex from "@/components/templates/flex" import { TextMicro } from "@/components/typography" import { Input, LabelText } from "./styled" +const Error = ({ error }) => { + const errorMessage = error === true ? "invalid" : error + + return typeof errorMessage === "string" ? ( + {errorMessage} + ) : ( + !!errorMessage && errorMessage + ) +} + export const TextInput = ({ error, disabled, @@ -21,10 +31,9 @@ export const TextInput = ({ size = "large", containerStyles, inputContainerStyles, + hideErrorMessage, ...props }) => { - const errorMessage = error === true ? "invalid" : error - return ( {typeof label === "string" ? {label} : label} @@ -61,11 +70,7 @@ export const TextInput = ({ )} {typeof hint === "string" ? {hint} : !!hint && hint} - {typeof errorMessage === "string" ? ( - {errorMessage} - ) : ( - !!errorMessage && errorMessage - )} + {!hideErrorMessage ? : null} ) }