From 1ec843d8b85786165656a2553f976c38651e90a9 Mon Sep 17 00:00:00 2001 From: John Kapantzakis Date: Mon, 5 Feb 2024 16:35:17 +0200 Subject: [PATCH 1/3] Add the 'hideErrorMessage' prop to text input --- src/components/input/input.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/input/input.js b/src/components/input/input.js index 9a12f4688..399fae44e 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} ) } From 9c3f08ce893587a3392558a308560f60c7eb899d Mon Sep 17 00:00:00 2001 From: John Kapantzakis Date: Mon, 5 Feb 2024 17:22:26 +0200 Subject: [PATCH 2/3] Remove default value --- src/components/input/input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/input/input.js b/src/components/input/input.js index 399fae44e..b0ea557e0 100644 --- a/src/components/input/input.js +++ b/src/components/input/input.js @@ -3,7 +3,7 @@ import Flex from "@/components/templates/flex" import { TextMicro } from "@/components/typography" import { Input, LabelText } from "./styled" -const Error = ({ error } = {}) => { +const Error = ({ error }) => { const errorMessage = error === true ? "invalid" : error return typeof errorMessage === "string" ? ( From 1c4913b638c4df8b319d9827cde657a8fc46f5fa Mon Sep 17 00:00:00 2001 From: John Kapantzakis Date: Mon, 5 Feb 2024 17:23:00 +0200 Subject: [PATCH 3/3] v4.3.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",