import { Meta, StoryObj } from '@storybook/react-webpack5'; import { fn } from 'storybook/test'; import { lorem10 } from '../../test-utils'; import Checkbox from '../Checkbox'; import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import { withVariantConfig } from '../../../.storybook/helpers'; const meta: Meta = { component: Checkbox, tags: ['!autodocs', '!manifest'], title: 'Forms/Checkbox/Tests', args: { label: 'This is the label', onChange: fn(), }, }; export default meta; type Story = StoryObj; export const MultipleMobile: Story = { render: (args) => { return ( <> ); }, ...withVariantConfig(['default', 'dark', 'mobile']), }; /** * The checkbox indicator sits to the start of the label: in LTR it appears on the left, * in RTL it should appear on the right. The secondary line wraps under the label text, * so both single-line and two-line layouts are verified here. */ export const RTLDiff: Story = { render: () => { const i18n = useRtlDiffI18n(); return ( <> {}} /> {}} /> ); }, ...withRTLDiff({ i18n: { labelOnly: { en: 'Label only', ar: 'التسمية فقط' }, withSecondary: { en: 'Label with secondary', ar: 'تسمية مع وصف ثانوي' }, secondaryDescription: { en: 'Secondary description text', ar: 'نص الوصف الثانوي' }, }, }), };