import {
  Canvas,
  Meta,
  Story,
  ArgsTable
} from '@storybook/addon-docs'
import RplFormRadioGroup from './RplFormRadioGroup.vue'

export const SingleTemplate = (args) => ({
  components: { RplFormRadioGroup },
  setup() {
    return { args }
  },
  template: '<RplFormRadioGroup v-bind="args" />'
})

<Meta title='Forms/Radio group' component={RplFormRadioGroup} args={{
      id: 'radio-default',
      name: 'radio-default',
      options: [
        {
          id: 'item-1',
          label: 'Here is a radio'
        },
        {
          id: 'item-2',
          label: 'Here is a radio with a very long label, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'
        },
        {
          id: 'item-3',
          label: 'Here is another radio'
        }
      ],
      value: 'item-2'
    }} />

# Forms

<ArgsTable of={RplFormradio} />

<Canvas>
  <Story
    name='Default variant'
    args={{
      id: 'radio-default'
    }}
  >
    {SingleTemplate.bind()}
  </Story>
</Canvas>


<Canvas>
  <Story
    name='Reverse variant'
    parameters={{
      background: 'gray'
    }}
    args={{
      id: 'radio-reverse',
      variant: 'reverse'
    }}
  >
    {SingleTemplate.bind()}
  </Story>
</Canvas>

<Canvas>
  <Story
    name='Inactive'
    args={{
      id: 'radio-inactive',
      label: 'Here is a radio',
      disabled: true,
    }}
  >
    {SingleTemplate.bind()}
  </Story>
</Canvas>


<Canvas>
  <Story
    name='Inactive - single item'
    args={{
      id: 'radio-long-label',
      options: [
        {
          id: 'item-1',
          label: 'Here is a radio',
          disabled: true
        },
        {
          id: 'item-2',
          label: 'Here is a radio with a very long label, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'
        },
      ],
      value: 'item-2'
    }}
  >
    {SingleTemplate.bind()}
  </Story>
</Canvas>

<Canvas>
  <Story
    name='Horizontal layout'
    args={{
      id: 'radio-long-label',
      layout: 'inline',
      options: [
        {
          id: 'item-1',
          label: 'Here is a radio',
        },
        {
          id: 'item-2',
          label: 'And another'
        },
      ],
      value: 'item-2'
    }}
  >
    {SingleTemplate.bind()}
  </Story>
</Canvas>


