import type { Meta, StoryObj } from '@storybook/react'
import { Cat, Dog, Fish, Rabbit, Turtle } from 'lucide-react'
import {
Select,
SelectTrigger,
SelectContent,
SelectItem,
SelectValue,
} from '../Select/Select'
import { MultiSelect } from './MultiSelect'
const options = [
{ label: 'React', value: 'react' },
{ label: 'Vue', value: 'vue' },
{ label: 'Angular', value: 'angular' },
{ label: 'Svelte', value: 'svelte' },
{ label: 'Ember', value: 'ember' },
]
const optionsWithIcons = [
{ label: 'Cat', value: 'cat', icon: Cat },
{ label: 'Dog', value: 'dog', icon: Dog },
{ label: 'Rabbit', value: 'rabbit', icon: Rabbit },
{ label: 'Turtle', value: 'turtle', icon: Turtle },
{ label: 'Fish', value: 'fish', icon: Fish },
]
const networkOptions = [
{
value: 'arbitrum',
label: 'Arbitrum',
icon: ({ className }: { className?: string }) => (
),
},
{
value: 'avalanche',
label: 'Avalanche',
icon: ({ className }: { className?: string }) => (
),
},
{
value: 'base',
label: 'Base',
icon: ({ className }: { className?: string }) => (
),
},
{
value: 'ethereum',
label: 'Ethereum',
icon: ({ className }: { className?: string }) => (
),
},
{
value: 'solana',
label: 'Solana',
icon: ({ className }: { className?: string }) => (
),
},
{
value: 'polygon',
label: 'Polygon',
icon: ({ className }: { className?: string }) => (
),
},
]
const groupedOptions = [
{
heading: 'Frontend',
options: [
{ label: 'React', value: 'react' },
{ label: 'Vue', value: 'vue' },
{ label: 'Angular', value: 'angular' },
],
},
{
heading: 'Backend',
options: [
{ label: 'Node.js', value: 'node' },
{ label: 'Python', value: 'python' },
{ label: 'Go', value: 'go' },
],
},
{
heading: 'Database',
options: [
{ label: 'PostgreSQL', value: 'postgresql' },
{ label: 'MongoDB', value: 'mongodb' },
{ label: 'Redis', value: 'redis' },
],
},
]
const meta = {
title: 'Form/MultiSelect',
component: MultiSelect,
argTypes: {
options: {
control: 'object',
description: 'Options to display',
},
defaultValue: {
control: 'object',
description: 'Default selected values',
},
placeholder: {
control: 'text',
description: 'Placeholder text',
},
maxCount: {
control: 'number',
description: 'Maximum number of items to display',
},
disabled: {
control: 'boolean',
description: 'Disable the component',
},
searchable: {
control: 'boolean',
description: 'Enable search functionality',
},
autoSize: {
control: 'boolean',
description: 'Auto size width',
},
size: {
control: 'select',
options: ['default', 'sm', 'xs'],
description: 'Size of the component',
},
open: {
control: 'boolean',
description: 'Controlled open state',
},
defaultOpen: {
control: 'boolean',
description: 'Default open state',
},
onValueChange: { control: false },
},
args: {
options,
placeholder: 'Select frameworks',
maxCount: 3,
onValueChange: () => {},
},
decorators: [
(Story, context) => (