import React, { useRef, useState } from 'react';
import { UnitField } from '@lendi/ui/UnitField';
import { Button } from '@lendi/ui/Button';
import { Spacer } from '@lendi/ui/Layout';
export const Interactive = (args) => ;
Interactive.args = {
label: 'Label text',
variant: 'age',
};
export const Variants = () => (
);
export const Controlled = (args) => {
const [value, setValue] = useState();
const handleChange = (e) => {
console.log(e.target.value);
setValue(e.target.value);
};
const handleOnValueChange = (value) => {
console.info('value', value);
};
return ;
};
Controlled.args = {
label: 'Label',
placeholder: 'Placeholder text',
helpText: 'Help text',
variant: 'percent',
};
export const Uncontrolled = () => {
const inputRef = useRef(null);
const showVal = () => {
console.log(inputRef.current.value);
};
return (
);
};
export const Errors = () => (
);
export const Labels = () => (
);
export const Widths = () => (
);
export const Validation = () => {
const [validationState, setValidationState] = useState<'valid' | 'invalid'>('valid');
const handleChange = (e) => {
if (e.target.validity.patternMismatch) {
console.log(e.target.validity);
setValidationState('invalid');
} else {
setValidationState('valid');
}
};
return (
);
};