import type { Meta, StoryObj } from '@storybook/react-webpack5'; import { fn, userEvent, within } from 'storybook/test'; import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import ExpressiveMoneyInput from '..'; import { Rewards } from '@transferwise/icons'; export default { component: ExpressiveMoneyInput, title: 'Forms/ExpressiveMoneyInput/Tests/RTL Diff', tags: ['!autodocs', '!manifest'], } satisfies Meta; type Story = StoryObj; const currencySelectorOptions = [ { title: 'Popular', currencies: [ { code: 'GBP', label: 'British Pound', keywords: ['british'] }, { code: 'EUR', label: 'Euro', keywords: ['euro'] }, { code: 'USD', label: 'US Dollar', keywords: ['dollar'] }, ], }, ]; export const TriggerVariants: Story = { render: () => { const i18n = useRtlDiffI18n(); return ( <> {/* Currency selector on leading side — flips in RTL */} {/* Chevron on trailing side — flips in RTL */} {/* InlinePrompt with media icon — icon on leading end of prompt */} , }} onAmountChange={fn()} /> {/* Secondary avatar addon in currency selector */} ); }, ...withRTLDiff({ fixedRows: { heights: [8, 8, 10, 8] }, renderAs: 'iframe', width: 'stretch', i18n: { youSend: { en: 'You send', ar: 'أنت ترسل' }, greatRate: { en: 'Great rate available', ar: 'سعر تحويل رائع متاح' }, profileName: { en: 'Mikkael Jordan', 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', width: '80%', i18n: { youSend: { en: 'You send', ar: 'أنت ترسل' }, popularGroup: { en: 'Popular', ar: 'الأكثر شيوعًا' }, britishPound: { en: 'British Pound', ar: 'الجنيه الإسترليني' }, euro: { en: 'Euro', ar: 'اليورو' }, usDollar: { en: 'US Dollar', ar: 'الدولار الأمريكي' }, }, }), };