Skip to content

Commit 2a4d336

Browse files
authored
Merge pull request #815 from buildo/text-field-type-bug
2 parents a17e74a + 4210393 commit 2a4d336

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: packages/bento-design-system/src/TextField/TextField.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ export function TextField(props: Props) {
4949
? props.hidePasswordLabel ?? defaultMessages.TextField.hidePasswordLabel
5050
: props.showPasswordLabel ?? defaultMessages.TextField.showPasswordLabel;
5151

52-
const type = props.type === "password" && !showPassword ? "password" : "text";
52+
const type = match(props.type ?? "text")
53+
.with("password", () => (showPassword ? "text" : "password"))
54+
.with("text", "email", "url", () => props.type)
55+
.exhaustive();
5356

5457
const rightAccessory = match(props.type ?? "text")
5558
.with("password", () => (

0 commit comments

Comments
 (0)