import React, { useRef, useState } from "react"; import { useForm, FormProvider } from "react-hook-form"; import * as Yup from "yup"; import { yupResolver } from "@hookform/resolvers/yup"; import { Meta, StoryFn } from "@storybook/react"; import { faker } from "@faker-js/faker"; import { onSubmit } from ":/components/Forms/Examples/ReactHookForm/reactHookFormUtils"; import { Select, SelectHandle } from ":/components/Forms/Select"; import { Button } from ":/components/Button"; import { RhfSelect } from ":/components/Forms/Select/stories-utils"; export default { title: "Components/Forms/Select/Multi", component: Select, } as Meta; const Template: StoryFn = (args) => { return (
setValue(e.target.value as string[])} />
); }; export const Overflow = { render: Template, args: { label: "Select cities", options: [ { value: "1", label: "Very long long long long long long long city name", }, ], defaultValue: "1", }, }; export const SearchableEmpty = { render: Template, args: { label: "Select cities", options: OPTIONS, searchable: true, }, }; export const SearchableUncontrolled = { render: Template, args: { label: "Select cities", options: OPTIONS, defaultValue: OPTIONS[4].value, searchable: true, }, }; export const SearchableDisabled = { render: Template, args: { label: "Select cities", options: OPTIONS, defaultValue: OPTIONS[4].value, searchable: true, disabled: true, }, }; export const SearchableControlled = () => { const [value, setValue] = useState([OPTIONS[6].value, OPTIONS[8].value]); return (
Value: {JSON.stringify(value)}
); }; export const SearchableRef = () => { const ref = useRef(null); return ( <>