import { jsx as _jsx } from "react/jsx-runtime";
import { useState } from 'react';
import { format } from 'date-fns';
import es from 'date-fns/locale/es';
import WeekMonthSelector from '.';
import { WeekMonthPeriod } from './types';
const meta = {
    component: WeekMonthSelector,
    title: 'Composed Components/WeekMonthSelector',
    tags: ['autodocs'],
    args: {
        dateFormatter: (date, pattern = 'dd/MMM/yyyy') => {
            try {
                return format(new Date(date), pattern, { locale: es });
            }
            catch {
                return '';
            }
        },
    },
};
export default meta;
export const Weekly = {
    render: args => {
        const today = new Date();
        const [fromDate, setFromDate] = useState(today);
        const [toDate, setToDate] = useState(today);
        return (_jsx(WeekMonthSelector, { ...args, fromDate: fromDate, toDate: toDate, handleFromChange: setFromDate, handleToChange: setToDate, initialPeriod: WeekMonthPeriod.WEEKLY }));
    },
};
export const Monthly = {
    render: args => {
        const today = new Date();
        const [fromDate, setFromDate] = useState(today);
        const [toDate, setToDate] = useState(today);
        return (_jsx(WeekMonthSelector, { ...args, fromDate: fromDate, toDate: toDate, handleFromChange: setFromDate, handleToChange: setToDate, initialPeriod: WeekMonthPeriod.MONTHLY }));
    },
};
