import { html } from 'lit';
import { ifDefined } from 'lit-html/directives/if-defined.js';
import { action } from 'storybook/actions';
import './QuantitySelector.svelte';
const meta = {
    title: 'Form Elements/Quantity Selector',
    component: 'm-quantityselector',
    subcomponents: { Field: 'm-field' },
    args: {
        id: 'quantitySelectorId',
        value: 10,
        min: 5,
        max: 20,
    },
    argTypes: {
        size: {
            control: 'radio',
            options: ['s', 'm'],
        },
    },
    render: (args) => {
        const onInput = action('input');
        const onChange = action('change');
        const onFocus = action('focus');
        const onBlur = action('blur');
        return html `
      <m-quantityselector
        id=${ifDefined(args.id)}
        name=${ifDefined(args.name)}
        value=${ifDefined(args.value)}
        ?isinvalid=${args.isinvalid}
        ?disabled=${args.disabled}
        size=${ifDefined(args.size)}
        min=${ifDefined(args.min)}
        max=${ifDefined(args.max)}
        step=${ifDefined(args.step)}
        ?readonly=${args.readonly}
        incrementlabel=${ifDefined(args.incrementlabel)}
        decrementlabel=${ifDefined(args.decrementlabel)}
        @input=${(event) => {
            onInput(event);
        }}
        @change=${(event) => {
            onChange(event);
        }}
        @focus=${(event) => {
            onFocus(event);
        }}
        @blur=${(event) => {
            onBlur(event);
        }}
      ></m-quantityselector>
    `;
    },
};
export default meta;
export const Default = {};
export const Step = {
    args: {
        id: 'stepId',
        step: 5,
    },
};
export const Small = {
    args: {
        id: 'smallId',
        size: 's',
    },
};
export const Disabled = {
    args: {
        id: 'disableId',
        disabled: true,
    },
};
export const ReadOnly = {
    args: {
        id: 'readonlyId',
        readonly: true,
    },
};
export const Invalid = {
    args: {
        id: 'invalidId',
        isinvalid: true,
    },
};
