import type { Meta, StoryObj } from '@storybook/vue3-vite'; import { ref } from 'vue'; import DigitInputGroup from '../digit-input-group.vue'; import DigitInputSlot from '../digit-input-slot.vue'; import DigitInput from '../digit-input.vue'; const meta: Meta = { title: 'Components/Input/Digit Input', component: DigitInput, argTypes: { modelValue: { control: { type: 'object' }, description: 'Array of string values for each input', }, disabled: { control: { type: 'boolean' }, description: 'Whether the input is disabled', }, placeholder: { control: { type: 'text' }, description: 'Placeholder character for empty slots', defaultValue: '●', }, mask: { control: { type: 'boolean' }, description: 'Whether to mask the input (for passwords)', }, otp: { control: { type: 'boolean' }, description: 'Whether this is for OTP input', }, type: { control: { type: 'select' }, options: ['text', 'password', 'number'], description: 'Input type', }, hasError: { control: { type: 'boolean' }, description: 'Whether the input has an error state', }, }, }; export default meta; type Story = StoryObj; export const Default: Story = { args: { placeholder: '●', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['', '', '', '']); return { args, value }; }, template: ` `, }), }; export const WithPlaceholder: Story = { args: { placeholder: '●', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['', '', '', '', '', '']); return { args, value }; }, template: ` `, }), }; export const OTPInput: Story = { args: { otp: true, placeholder: '●', type: 'number', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['', '', '', '', '', '']); return { args, value }; }, template: ` `, }), }; export const PasswordInput: Story = { args: { mask: true, type: 'number', placeholder: '●', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['', '', '', '']); return { args, value }; }, template: ` `, }), }; export const Disabled: Story = { args: { disabled: true, placeholder: '●', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['1', '2', '3', '']); return { args, value }; }, template: ` `, }), }; export const LongerInput: Story = { args: { placeholder: '●', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['', '', '', '', '', '', '', '']); return { args, value }; }, template: ` `, }), }; export const PrefilledValue: Story = { args: { placeholder: '●', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['1', '2', '3', '4']); return { args, value }; }, template: ` `, }), }; export const ErrorState: Story = { args: { placeholder: '●', hasError: true, }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['1', '2', '', '']); return { args, value }; }, template: ` `, }), }; export const Responsive: Story = { args: { otp: true, placeholder: '●', type: 'number', }, render: args => ({ components: { DigitInput, DigitInputSlot, DigitInputGroup }, setup() { const value = ref(['', '', '', '', '', '']); return { args, value }; }, template: `

Container width: 320px (small mobile)

`, }), };