import { html } from 'lit';
import { ifDefined } from 'lit-html/directives/if-defined.js';
import { action } from 'storybook/actions';
import './Datepicker.svelte';
const meta = {
    title: 'Form Elements/Datepicker',
    component: 'm-datepicker',
    subcomponents: { Field: 'm-field' },
    tags: ['v2'],
    argTypes: {
        size: {
            control: 'radio',
            options: ['s', 'm'],
        },
    },
    args: {
        id: 'datepickerId',
    },
    render: (args) => {
        const onInput = action('input');
        const onChange = action('change');
        const onFocus = action('focus');
        const onBlur = action('blur');
        return html `
      <m-datepicker
        id=${ifDefined(args.id)}
        name=${ifDefined(args.name)}
        value=${ifDefined(args.value)}
        ?isinvalid=${args.isinvalid}
        ?disabled=${args.disabled}
        size=${ifDefined(args.size)}
        ?readonly=${args.readonly}
        ?isclearable=${args.isclearable}
        clearlabel=${ifDefined(args.clearlabel)}
        @input=${(event) => {
            onInput(event);
        }}
        @change=${(event) => {
            onChange(event);
        }}
        @focus=${(event) => {
            onFocus(event);
        }}
        @blur=${(event) => {
            onBlur(event);
        }}
      ></m-datepicker>
    `;
    },
};
export default meta;
export const Value = {
    args: {
        id: 'withValueId',
        value: '2025-07-22',
        isclearable: true,
    },
};
export const Default = {};
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,
    },
};
