Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 12 additions & 7 deletions src/components/input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" ? (
<TextMicro color="errorText">{errorMessage}</TextMicro>
) : (
!!errorMessage && errorMessage
)
}

export const TextInput = ({
error,
disabled,
Expand All @@ -21,10 +31,9 @@ export const TextInput = ({
size = "large",
containerStyles,
inputContainerStyles,
hideErrorMessage,
...props
}) => {
const errorMessage = error === true ? "invalid" : error

return (
<Flex gap={0.5} column className={className} {...containerStyles} as="label">
{typeof label === "string" ? <LabelText size={size}>{label}</LabelText> : label}
Expand Down Expand Up @@ -61,11 +70,7 @@ export const TextInput = ({
)}
</Flex>
{typeof hint === "string" ? <TextMicro color="textLite">{hint}</TextMicro> : !!hint && hint}
{typeof errorMessage === "string" ? (
<TextMicro color="errorText">{errorMessage}</TextMicro>
) : (
!!errorMessage && errorMessage
)}
{!hideErrorMessage ? <Error error={error} /> : null}
</Flex>
)
}