From 42103934ef368b3d4fc76ffeb52a7d303d9af89e Mon Sep 17 00:00:00 2001 From: Gabriele Petronella Date: Tue, 28 Nov 2023 17:19:49 +0100 Subject: [PATCH] Bugfix: TextField discards type other than "text" or "password" --- packages/bento-design-system/src/TextField/TextField.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/bento-design-system/src/TextField/TextField.tsx b/packages/bento-design-system/src/TextField/TextField.tsx index fc87b4fd3..2a4cc245e 100644 --- a/packages/bento-design-system/src/TextField/TextField.tsx +++ b/packages/bento-design-system/src/TextField/TextField.tsx @@ -49,7 +49,10 @@ export function TextField(props: Props) { ? props.hidePasswordLabel ?? defaultMessages.TextField.hidePasswordLabel : props.showPasswordLabel ?? defaultMessages.TextField.showPasswordLabel; - const type = props.type === "password" && !showPassword ? "password" : "text"; + const type = match(props.type ?? "text") + .with("password", () => (showPassword ? "text" : "password")) + .with("text", "email", "url", () => props.type) + .exhaustive(); const rightAccessory = match(props.type ?? "text") .with("password", () => (