// External dependencies. import React from 'react'; import { useArgs } from '@storybook/preview-api'; import { action } from '@storybook/addon-actions'; // Internal dependencies. import ETBuilderControlSelectAdvanced from '../../controls/select-advanced/select-advanced'; // Define the default metadata for the story export default { title: 'Controls/Select Advanced', component: ETBuilderControlSelectAdvanced, render: args => { const [, updateArgs] = useArgs(); const handleOnChange = (attrName, selectedValue) => { action('changed')(attrName, selectedValue); updateArgs({ value: selectedValue }); } return (
); }, argTypes: { options: { table: { disable: true, } }, onOpen: { table: { disable: true, } }, onClose: { table: { disable: true, } }, labelFilter: { table: { disable: true, } }, onChange: { action: 'changed', table: { disable: true, }, }, beforeList: { table: { disable: true, } }, afterList: { table: { disable: true, } }, getSvgContent: { table: { disable: true, } }, value: { control: 'text' }, }, }; export const Default = { args: { label: 'Select Advanced', options: ['Apple', 'Banana', 'Orange'], name: 'default', value: '', }, }; export const OptionsObject = { args: { ...Default.args, label: 'Object Options', options: { Apple: 'Apple', Banana: 'Banana', Orange: 'Orange', }, }, }; export const OptionsWithSubOptions = { args: { ...Default.args, label: 'Sub Options', options: { Vegetable: { Tomato: 'Tomato', Carrot: 'Carrot', }, Fruits: { Apple: 'Apple', Banana: 'Banana', }, }, }, }; export const FirstNotSelected = { args: { ...Default.args, selectFirst: false, emptyLabel: 'Please select an option...', value: undefined } } export const Searchable = { args: { ...Default.args, searchable: true, } } export const ActiveOnLoad = { args: { ...Default.args, activeOnLoad: true, }, parameters: { layout: 'fullscreen', }, } export const BeforeAndAfterList = { args: { ...Default.args, beforeList: () => 'Before Fruits List', afterList: () => 'After Fruits List', } } export const AdditionalContentFirst = { args: { ...Default.args, additionalContentFirst: true, getSvgContent: () => { return ( ); } } }