/* eslint-disable react-hooks/rules-of-hooks */
import React, {useState} from 'react';
import {Meta, StoryObj} from '@storybook/react';

import {InputPassword} from './index';

const meta: Meta<typeof InputPassword> = {
  title: 'HuGo/Inputs/InputPassword',
  component: InputPassword,
  argTypes: {
    label: {type: 'string'},
    placeholder: {type: 'string'},
    helper: {type: 'string'},
    disabled: {type: 'boolean'},
    isError: {type: 'boolean'},
    isSuccess: {type: 'boolean'},
    size: {
      control: 'select',
      options: ['sm', 'lg'],
      defaultValue: 'lg',
    },
  },
};

type Story = StoryObj<typeof InputPassword>;

export const InputPasswordComponent: Story = {
  args: {
    label: 'Label',
    placeholder: 'Placeholder',
    helper: 'Helper',
    disabled: false,
    isError: false,
    isSuccess: false,
    size: 'lg',
  },
  render: args => {
    const [value, setValue] = useState('');
    return <InputPassword value={value} onChangeText={setValue} {...args} />;
  },
};

export const SmallInputPassword: Story = {
  args: {
    ...InputPasswordComponent.args,
    size: 'sm',
    placeholder: 'Small password input',
  },
  render: InputPasswordComponent.render,
};

export default meta;
