import N8nSelect from './Select.vue';
import N8nOption from '../N8nOption';
import N8nIcon from '../N8nIcon';
import { action } from '@storybook/addon-actions';
export default {
title: 'Atoms/Select',
component: N8nSelect,
argTypes: {
disabled: {
control: {
type: 'boolean',
},
},
size: {
control: {
type: 'select',
options: ['large', 'medium', 'small', 'mini'],
},
},
loading: {
control: {
type: 'boolean',
},
},
filterable: {
control: {
type: 'boolean',
},
},
defaultFirstOption: {
control: {
type: 'boolean',
},
},
},
parameters: {
backgrounds: { default: '--color-background-light' },
},
};
const methods = {
onInput: action('input'),
onChange: action('change'),
};
const Template = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nSelect,
N8nOption,
N8nIcon,
},
template: 'op1op2',
data() {
return {
val: '',
};
},
methods,
});
export const Input = Template.bind({});
export const Filterable = Template.bind({});
Filterable.args = {
filterable: true,
defaultFirstOption: true,
};
const selects = ['large', 'medium', 'small', 'mini'].map((size) => `op1op2`).join('');
const ManyTemplate = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nSelect,
N8nOption,
N8nIcon,
},
template: `
${selects}
`,
methods,
data() {
return {
val: '',
};
},
});
export const Sizes = ManyTemplate.bind({});
Sizes.args = {
type: 'text',
label: 'text input:',
placeholder: 'placeholder...',
};
const selectsWithIcon = ['xlarge', 'large', 'medium', 'small', 'mini'].map((size) => `op1op2`).join('');
const ManyTemplateWithIcon = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nSelect,
N8nOption,
N8nIcon,
},
template: `${selectsWithIcon}
`,
methods,
data() {
return {
val: '',
};
},
});
export const WithIcon = ManyTemplateWithIcon.bind({});
WithIcon.args = {
type: 'text',
label: 'text input:',
placeholder: 'placeholder...',
};
const LimitedWidthTemplate = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nSelect,
N8nOption,
N8nIcon,
},
template: '
',
data() {
return {
val: '',
};
},
methods,
});
export const LimitedWidth = LimitedWidthTemplate.bind({});
LimitedWidth.args = {
type: 'text',
label: 'text input:',
placeholder: 'placeholder...',
};