import type { Meta, StoryObj } from '@storybook/react'; import InputWithDropdown from './InputWithDropdown'; import { ChangeEvent, useState } from 'react'; import { Option } from './types'; const meta: Meta = { title: 'Components/InputWithDropdown', component: InputWithDropdown, parameters: { layout: 'centered', }, tags: ['autodocs'], }; type Story = StoryObj; let optionsList = [ { label: 'option 1', value: 'option 1' }, { label: 'option 2', value: 'option 2' }, { label: 'option 3', value: 'option 3' }, { label: 'option 4', value: 'option 4' }, ]; let selectedOption = { label: 'option 2', value: 'option 2' }; const defaultArgs = { label: 'Field-Name', disabled: false, placeholder: 'Enter your name', optionsList: optionsList, selectedOption: selectedOption, }; export const Default: Story = { args: { ...defaultArgs, disabled: false, required: false, }, }; export const DisabledWithValue: Story = { args: { ...defaultArgs, variant: 'primary', type: 'text', value: 'Disabled', disabled: true, required: true, }, }; export const Controlled: Story = { render: () => { const [value, setValue] = useState(''); const [error, setError] = useState(false); const [helperText, setHelperText] = useState(''); const optionsListToPass = [ { label: 'milliseconds', value: 'milliseconds' }, { label: 'seconds', value: 'seconds' }, { label: 'minutes', value: 'minutes' }, { label: 'hours', value: 'hours' }, ]; const [selectedOption, setSelectedOption] = useState