import type { Meta, StoryObj } from '@storybook/react-webpack5'; import { userEvent, within } from 'storybook/test'; import { Person } from '@transferwise/icons'; import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator'; import Select from '..'; export default { component: Select, title: 'Forms/Select/Tests/RTL Diff', tags: ['!autodocs', '!manifest', 'deprecated'], } satisfies Meta; type Story = StoryObj; const getOptions = (i18n: Record) => [ { header: i18n.popularHeader }, { value: 'gbp', label: i18n.britishPound, currency: 'gbp', icon: }, { value: 'eur', label: i18n.euro, currency: 'eur', icon: }, { value: 'usd', label: i18n.usDollar, currency: 'usd', note: i18n.usDollarNote }, { separator: true }, { header: i18n.otherHeader }, { value: 'cad', label: i18n.canadianDollar, currency: 'cad' }, { value: 'aud', label: i18n.australianDollar, currency: 'aud' }, ]; const getSelected = (i18n: Record) => ({ value: 'gbp', label: i18n.britishPound, currency: 'gbp', icon: , }); export const TriggerVariants: Story = { render: () => { const i18n = useRtlDiffI18n(); return ( <> {}} /> {}} /> ); }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); const trigger = canvas.queryByRole('button'); if (!trigger) return; await userEvent.click(trigger); }, ...withRTLDiff({ renderAs: 'iframe', width: '80%', i18n: { searchPlaceholder: { en: 'Type a currency', ar: 'اكتب عملة' }, placeholder: { en: 'Select currency', ar: 'اختر العملة' }, popularHeader: { en: 'Popular', ar: 'الأكثر شيوعًا' }, britishPound: { en: 'British pound', ar: 'الجنيه الإسترليني' }, euro: { en: 'Euro', ar: 'اليورو' }, usDollar: { en: 'US Dollar', ar: 'الدولار الأمريكي' }, usDollarNote: { en: 'United States dollar', ar: 'دولار الولايات المتحدة' }, otherHeader: { en: 'Other', ar: 'أخرى' }, canadianDollar: { en: 'Canadian dollar', ar: 'الدولار الكندي' }, australianDollar: { en: 'Australian dollar', ar: 'الدولار الأسترالي' }, }, }), };