import type { Meta, StoryObj } from '@storybook/react'; import { within, userEvent } from 'storybook/test'; import React, { useState } from 'react'; import { DropdownItem } from '../../DropdownItem'; import { Select } from '../Select'; import type { Option } from '../option'; import { AutocompleteNoOptions } from '../../AutocompleteNoOptions'; type CostCenter = Option & { owner: string; }; const costCenters: CostCenter[] = [ { key: 'marketing', label: 'Marketing', owner: 'Michael Murphy', }, { key: 'legal', label: 'Legal', owner: 'Nayden Lennart', }, { key: 'office', label: 'Office', owner: 'Nicolas Harvey', }, { key: 'platform', label: 'Platform', owner: 'Lewis Barker', }, { key: 'finance', label: 'Finance', owner: 'George Gray', }, { key: 'recruitment', label: 'Recruitment', owner: 'Laura Lagarde', }, ]; const meta: Meta = { title: 'Form/Select', component: Select, parameters: { layout: 'centered', chromatic: { disableSnapshot: false }, }, decorators: [ (Story) => (
), ], args: { placeholder: 'Select a cost center', options: costCenters, fit: 'parent', }, }; export default meta; type Story = StoryObj; export const Default: Story = { args: { fit: 'content', }, render: (args) => { const [selectedOption, setSelectedOption] = useState