import type { Meta, StoryObj } from '@storybook/react-webpack5'; import { fn, userEvent, within } from 'storybook/test'; import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import DateInput from '..'; export default { component: DateInput, title: 'Forms/DateInput/Tests/RTL Diff', tags: ['!autodocs', '!manifest'], } satisfies Meta; type Story = StoryObj; export const Sizes: Story = { render: () => { const i18n = useRtlDiffI18n(); return ( <> ); }, ...withRTLDiff({ renderAs: 'iframe', fixedRows: { heights: [6, 7, 9] }, i18n: { dayLabel: { en: 'Day', ar: 'اليوم' }, monthLabel: { en: 'Month', ar: 'الشهر' }, yearLabel: { en: 'Year', ar: 'السنة' }, }, }), }; export const MobileSizes: Story = { render: () => { const i18n = useRtlDiffI18n(); return ( <> ); }, ...withRTLDiff({ viewport: 'smallMobile', fixedRows: { heights: [13, 16, 21] }, i18n: { dayLabel: { en: 'Day', ar: 'اليوم' }, monthLabel: { en: 'Month', ar: 'الشهر' }, yearLabel: { en: 'Year', ar: 'السنة' }, }, }), }; export const OpenDropdown: Story = { render: () => { const i18n = useRtlDiffI18n(); return ( {}} /> ); }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); const trigger = canvas.queryByRole('combobox'); if (!trigger) return; await userEvent.click(trigger); }, ...withRTLDiff({ renderAs: 'iframe', i18n: { dayLabel: { en: 'Day', ar: 'اليوم' }, monthLabel: { en: 'Month', ar: 'الشهر' }, yearLabel: { en: 'Year', ar: 'السنة' }, }, }), };