2025-02-28 13:46:00 +00:00
|
|
|
import React from "react";
|
2023-05-03 16:51:33 +00:00
|
|
|
import InputField from ".";
|
|
|
|
|
|
2025-02-28 13:46:00 +00:00
|
|
|
export default {
|
2023-05-03 16:51:33 +00:00
|
|
|
component: InputField,
|
|
|
|
|
title: "Components/FormFields/InputField",
|
2025-02-28 13:46:00 +00:00
|
|
|
argTypes: {
|
|
|
|
|
type: {
|
|
|
|
|
control: "select",
|
|
|
|
|
options: ["text", "password", "email", "number", "textarea"],
|
|
|
|
|
},
|
|
|
|
|
value: {
|
|
|
|
|
control: "text",
|
|
|
|
|
},
|
|
|
|
|
placeholder: {
|
|
|
|
|
control: "text",
|
|
|
|
|
},
|
|
|
|
|
label: {
|
|
|
|
|
control: "text",
|
|
|
|
|
},
|
|
|
|
|
error: {
|
|
|
|
|
control: "text",
|
|
|
|
|
},
|
|
|
|
|
helpText: {
|
|
|
|
|
control: "text",
|
|
|
|
|
},
|
|
|
|
|
disabled: {
|
|
|
|
|
control: "boolean",
|
|
|
|
|
},
|
|
|
|
|
readOnly: {
|
|
|
|
|
control: "boolean",
|
|
|
|
|
},
|
|
|
|
|
autofocus: {
|
|
|
|
|
control: "boolean",
|
|
|
|
|
},
|
|
|
|
|
enableCopy: {
|
|
|
|
|
control: "boolean",
|
|
|
|
|
},
|
2025-04-23 18:42:30 +00:00
|
|
|
enableShowSecret: {
|
|
|
|
|
control: "boolean",
|
|
|
|
|
},
|
2025-02-28 13:46:00 +00:00
|
|
|
},
|
2023-05-03 16:51:33 +00:00
|
|
|
};
|
|
|
|
|
|
2025-02-28 13:46:00 +00:00
|
|
|
const Template = (args) => <InputField {...args} />;
|
2023-05-03 16:51:33 +00:00
|
|
|
|
2025-02-28 13:46:00 +00:00
|
|
|
export const Basic = Template.bind({});
|
|
|
|
|
Basic.args = {
|
|
|
|
|
name: "basic-input",
|
|
|
|
|
label: "Basic Input",
|
|
|
|
|
value: "",
|
|
|
|
|
placeholder: "Enter text here",
|
|
|
|
|
};
|
2024-09-05 11:47:34 +00:00
|
|
|
|
2025-02-28 13:46:00 +00:00
|
|
|
export const WithValue = Template.bind({});
|
|
|
|
|
WithValue.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
value: "Sample text",
|
2024-09-05 11:47:34 +00:00
|
|
|
};
|
|
|
|
|
|
2025-02-28 13:46:00 +00:00
|
|
|
export const WithError = Template.bind({});
|
|
|
|
|
WithError.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
error: "This field is required",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Disabled = Template.bind({});
|
|
|
|
|
Disabled.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
disabled: true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const ReadOnly = Template.bind({});
|
|
|
|
|
ReadOnly.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
value: "Read-only content",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const WithHelpText = Template.bind({});
|
|
|
|
|
WithHelpText.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
helpText: "This is some helpful information about the input field.",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Password = Template.bind({});
|
|
|
|
|
Password.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
type: "password",
|
|
|
|
|
label: "Password",
|
|
|
|
|
placeholder: "Enter your password",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Textarea = Template.bind({});
|
|
|
|
|
Textarea.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
type: "textarea",
|
2025-04-23 18:42:30 +00:00
|
|
|
label: "Text area",
|
2025-02-28 13:46:00 +00:00
|
|
|
placeholder: "Enter multiple lines of text",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const WithCopyEnabled = Template.bind({});
|
|
|
|
|
WithCopyEnabled.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
enableCopy: true,
|
|
|
|
|
value: "This text can be copied",
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-13 14:24:32 +00:00
|
|
|
export const WithCopyEnabledInput = Template.bind({});
|
|
|
|
|
WithCopyEnabledInput.args = {
|
2025-02-28 13:46:00 +00:00
|
|
|
...WithCopyEnabled.args,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const WithTooltip = Template.bind({});
|
|
|
|
|
WithTooltip.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
tooltip: "This is a tooltip for the input field",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const AutoFocus = Template.bind({});
|
|
|
|
|
AutoFocus.args = {
|
|
|
|
|
...Basic.args,
|
|
|
|
|
autofocus: true,
|
2024-09-05 11:47:34 +00:00
|
|
|
};
|