),
group: 'We can also use custom option components'
}));
export const groupedOptions = {
users,
tenants: companies,
cities,
custom
};
export const argTypes: Partial<
ArgTypes, PickGlobalSearchArgTypes>>
> = {
disableGrouping: { description: 'Disable grouping', type: 'boolean' },
disabled: {
description: 'Toggle disabled state',
type: 'boolean',
defaultValue: false
},
readOnly: {
description: 'Toggle read only state',
type: 'boolean',
defaultValue: false
},
noOptionsText: {
description: 'The text that renders when no options',
type: 'string',
defaultValue: 'No options'
},
freeSolo: {
description:
'Enabling free solo will enable the input to not be constraint to the available options',
type: 'boolean',
defaultValue: false
},
limitTags: {
description: 'Max number of tags before showing a counter',
type: 'number',
defaultValue: -1
},
optionsBeforeScroll: {
description: 'Number of options to show in group before scroll',
type: 'number',
defaultValue: 5
},
openOnFocus: {
description: 'Open options list on focus',
type: 'boolean',
defaultValue: false
},
hideEndAdornment: {
description: 'Hide end adornment',
type: 'boolean',
defaultValue: false
},
endAdornmentIconSrc: {
description: 'End adornment icon src',
type: 'string',
options: [undefined, ...newIconSources],
defaultValue: undefined,
control: {
type: 'select'
}
},
onEndAdornmentClick: {
description: 'A Callback that fires when end adornment clicked',
type: 'function'
},
onChange: {
description: 'A Callback that fires when value has changed',
type: 'function'
},
onInputChange: {
description: 'A Callback that fires when input has changed',
type: 'function'
}
};
export const args: React.ComponentProps = {
disableGrouping: false,
disabled: false,
readOnly: false,
noOptionsText: 'No options',
groupedOptions,
// TODO: for some reason the action get undefined as the option, which does not happens when you use onChange outside of this scope. should investigate it
onChange: action('Value change'),
onInputChange: action('Input change'),
freeSolo: false,
limitTags: -1,
optionsBeforeScroll: 5,
openOnFocus: false,
hideEndAdornment: false,
endAdornmentIconSrc: undefined,
onEndAdornmentClick: action('End adornment clicked')
};
export const Template: ComponentStory = args => ;