import React, { useEffect, useState, useCallback } from 'react'; import { action } from 'storybook/actions'; import { States } from '../../utilities'; import { Input } from '../Field'; import { Select, SelectProps } from './Select'; import { MultiSelect } from './MultiSelect'; export default { title: 'Components/Select' }; const OPTIONS = [ { value: 'featured', label: 'Featured' }, { value: 'recency', label: "What's New", disabled: true }, { value: 'high', label: 'Price High to Low' }, { value: 'low', label: 'Price Low to High' } ]; export const Default = () => ( > states={[ { idRef: '1' }, { idRef: '2', value: 'high' }, { idRef: '3', label: 'Sort — ' }, { disabled: true, idRef: '4', label: 'Sort' }, { idRef: '5', label: '' }, { idRef: '5', label: '', error: 'Error' }, { idRef: '6', label: '', dropDirection: 'up' }, { idRef: '7', label: undefined, placeholder: 'Placeholder' } ]} > ); export const ChangingValue = () => { const [cursor, setCursor] = useState(0); const values = OPTIONS.map(({ value }) => value); const value = values[cursor % values.length]; const HALF_SECOND_INTERVAL = 500; useEffect(() => { const interval = setInterval(() => { setCursor(prevCursor => prevCursor + 1); }, HALF_SECOND_INTERVAL); return () => clearInterval(interval); }, []); return ({ label: country, value: country }))} /> ); export const AutoFill = () => ( <> ); }; export const InsideInputComponent = () => (