upend/webui/src/stories/Selector.stories.ts

91 lines
1.5 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/svelte';
import Selector from '../lib/components/utils/Selector.svelte';
import NarrowDecorator from './NarrowDecorator.svelte';
const meta: Meta<Selector> = {
title: 'Widgets/Selector',
component: Selector,
tags: ['autodocs'],
argTypes: {
onInput: {
action: 'input'
},
onFocus: {
action: 'focus'
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any
};
export default meta;
type Story = StoryObj<Selector>;
export const Attribute: Story = {
args: {
types: ['Attribute', 'NewAttribute']
}
};
export const AttributeInitial: Story = {
args: {
types: ['Attribute'],
initial: {
t: 'Attribute',
name: 'INITIAL_ATTR'
}
}
};
export const AllValues: Story = {
args: {
types: ['Attribute', 'NewAttribute', 'Address', 'NewAddress', 'String', 'Number']
}
};
export const Entities: Story = {
args: {
types: ['Address', 'NewAddress']
}
};
export const ExistingEntities: Story = {
args: {
types: ['Address']
}
};
export const Strings: Story = {
args: {
types: ['String']
}
};
export const StringInitial: Story = {
args: {
types: ['String'],
initial: {
t: 'String',
c: 'An Initial String.'
}
}
};
export const Numbers: Story = {
args: {
types: ['Number']
}
};
export const MultipleValues: Story = {
args: {
types: ['String', 'Number']
}
};
export const Narrow: Story = {
args: {
types: AllValues.args!.types
},
decorators: [() => NarrowDecorator as any]
};