import { useCallback, useRef, useState } from 'react' import * as React from 'react' import { SearchIcon } from '@channel.io/bezier-icons' import { type Meta, type StoryFn } from '@storybook/react' import { TextField } from './TextField' import { type TextFieldProps, type TextFieldRef } from './TextField.types' const meta: Meta = { component: TextField, } export default meta const PrimaryTemplate: StoryFn = ({ ...otherProps }) => { const inputRef = useRef(null) const [value, setValue] = useState('12345') const handleChangeValue = useCallback( (event: React.ChangeEvent) => { setValue(event.currentTarget.value) }, [] ) const handleClickLeftIcon = useCallback(() => { inputRef.current?.selectAll() }, []) return (
) } export const Primary = { render: PrimaryTemplate, args: { variant: 'primary', size: 'm', disabled: false, readOnly: false, allowClear: true, hasError: false, selectAllOnFocus: false, maxLength: 10, placeholder: 'this is placeholder', }, }