import type { Meta, StoryObj } from '@storybook/react'; import Select from './Select'; import { useState } from 'react'; import { Option } from './types'; const meta: Meta = { title: 'Components/Select', component: Select, parameters: { layout: 'centered', }, tags: ['autodocs'], }; type Story = StoryObj; export const Primary: Story = { args: { label: 'Select', optionsList: [ { label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }, { label: 'Option 3', value: '3' }, ], }, }; export const WithError: Story = { args: { label: 'Select', optionsList: [ { label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }, { label: 'Option 3', value: '3' }, ], errorMsg: 'Please select a option', }, }; export const WithoutLabel: Story = { args: { showLabel: false, optionsList: [ { label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }, { label: 'Option 3', value: '3' }, ], }, }; export const EmptyOptions: Story = { args: { label: 'Select', optionsList: [], errorMsg: 'No options available', }, }; export const Disable: Story = { args: { label: 'Select', optionsList: [], disabled: true, }, }; export const WithInitialValue: Story = { args: { label: 'Select', selectedOption: { label: 'Option 2', value: '2' }, optionsList: [ { label: 'Option 1', value: 'Option 1' }, { label: 'Option 2', value: 'Option 2' }, { label: 'Option 3', value: 'Option 3' }, ], }, }; export const OptionSelection: Story = { render: () => { const optionsList = [ { label: 'Option 1', value: 'Option 1' }, { label: 'Option 2', value: 'Option 2' }, { label: 'Option 3', value: 'Option 3' }, ]; const [selectedOption, setSelectedOption] = useState