Skip to content

Commit e28f5ac

Browse files
authored
feat(input): add all types (#80)
1 parent 7c5993a commit e28f5ac

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/components/input/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type InputProps = IntrinsicComponentProps<
1414
value?: string;
1515
defaultValue?: string;
1616
onChange?: (value: string) => void;
17-
type?: "text" | "textarea";
17+
type?: HTMLInputElement["type"] | "textarea";
1818
size?: "small" | "default" | "large";
1919
label?: string;
2020
danger?: boolean;
@@ -108,11 +108,9 @@ export function Input(props: InputProps) {
108108
{/* @ts-ignore: TS Can't infer type */}
109109
<Dynamic
110110
component={
111-
{
112-
text: TextField.Input,
113-
textarea: TextField.TextArea,
114-
}[local.type!]
111+
local.type === "textarea" ? TextField.TextArea : TextField.Input
115112
}
113+
type={local.type === "textarea" ? undefined : local.type}
116114
{...combinedProps}
117115
/>
118116

src/stories/Input.stories.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
onChange: { action: "onChange" },
1010
type: {
1111
control: { type: "select" },
12-
options: ["text", "textarea"],
12+
options: ["text", "textarea", "email", "password"],
1313
},
1414
size: {
1515
control: { type: "select" },

0 commit comments

Comments
 (0)