import React, { useState, useRef } from 'react';
import { TextField } from '@lendi/ui/TextField';
import { Button } from '@lendi/ui/Button';
import { Spacer } from '@lendi/ui/Layout';
export const Interactive = (args) => ;
// Note: Storybook's composeStories needs a default export or it will error, it doesn't seem to matter what it is
export default {
title: 'Text Field',
};
Interactive.args = {
label: 'Label',
placeholder: 'Placeholder text',
helpText: 'Help text example',
errorText: 'Error text example',
};
Interactive.argTypes = {
inlineAction: {
control: { type: 'radio', options: ['clear'] },
},
};
export const Widths = () => (
);
export const Errors = () => (
);
export const ClearAction = () => {
const [value, setValue] = useState('');
const inputRef = useRef();
const onChange = (e) => {
setValue(e.target.value);
};
return (
);
};
export const ClearActionWithValue = () => {
const defaultValue = 'Some text';
const [value, setValue] = useState(defaultValue);
const inputRef = useRef();
const onChange = (e) => {
setValue(e.target.value);
};
return (
);
};
export const AutoComplete = () => (
);
export const Labels = () => (
);
export const Controlled = (args) => {
const [value, setValue] = useState('');
const handleChange = (e) => {
console.log(e.target.value);
setValue(e.target.value);
};
return ;
};
Controlled.args = {
label: 'Label',
placeholder: 'Placeholder text',
helpText: 'Help text',
};
export const Uncontrolled = () => {
const inputRef = useRef(null);
const showVal = () => {
console.log(inputRef.current.value);
};
return (
);
};
export const Email = () => {
const inputRef = useRef(null);
return (
);
};