{"version":3,"file":"index.cjs","sources":["../src/hooks/useMultiStepForm.ts","../src/components/icons/CheckIcon.tsx","../src/components/ProgressBar.tsx","../src/components/FormControl.tsx","../src/components/FormStep.tsx","../src/components/WelcomeScreen.tsx","../src/components/icons/PartyPopperIcon.tsx","../src/components/CompletionScreen.tsx","../src/components/icons/ArrowLeftIcon.tsx","../src/components/icons/ArrowRightIcon.tsx","../src/components/MultiStepForm.tsx","../src/utils/validateFormConfig.ts"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport { FormConfig, FormStep, FormData, FormErrors, FormState } from '../types';\n\nexport const useMultiStepForm = (config: FormConfig, onSubmit?: (formData: FormData) => void) => {\n  const [currentStepIndex, setCurrentStepIndex] = useState(-1); // -1 for welcome screen\n  const [formData, setFormData] = useState<FormData>({});\n  const [errors, setErrors] = useState<FormErrors>({});\n\n  const steps = useMemo(() => config.steps, [config.steps]);\n\n  const isWelcomeScreen = currentStepIndex === -1;\n  const isCompletionScreen = currentStepIndex === steps.length;\n  const isFormActive = !isWelcomeScreen && !isCompletionScreen;\n\n  const currentStep: FormStep | undefined = isFormActive ? steps[currentStepIndex] : undefined;\n  \n  const validateStep = (step: FormStep): boolean => {\n    const newErrors: FormErrors = {};\n    let isValid = true;\n\n    for (const field of step.fields) {\n      const value = formData[field.id] || '';\n      if (field.required && !value.trim()) {\n        newErrors[field.id] = field.errorMessage || 'This field is required.';\n        isValid = false;\n      } else if (value && field.validationRegex) {\n        const regex = new RegExp(field.validationRegex);\n        if (!regex.test(value)) {\n          newErrors[field.id] = field.errorMessage || 'Invalid format.';\n          isValid = false;\n        }\n      } else if (field.allowOther && value.includes('__other__')) {\n        const otherValue = formData[`${field.id}_other`] || '';\n        if (!otherValue.trim()) {\n          newErrors[field.id] = 'Please specify your \"Other\" choice.';\n          isValid = false;\n        }\n      }\n    }\n\n    setErrors(newErrors);\n    return isValid;\n  };\n  \n  const startForm = () => {\n    setCurrentStepIndex(0);\n  };\n\n  const isLastStep = currentStepIndex === steps.length - 1;\n\n  const goToNextStep = () => {\n    if (currentStep && validateStep(currentStep)) {\n      if (isLastStep) {\n        onSubmit?.(formData);\n      }\n      if (currentStepIndex < steps.length) {\n        setCurrentStepIndex(index => index + 1);\n      }\n    }\n  };\n\n  const goToPreviousStep = () => {\n    if (currentStepIndex > 0) {\n      setErrors({});\n      setCurrentStepIndex(index => index - 1);\n    }\n  };\n  \n  const updateFormData = (fieldId: string, value: string) => {\n    setFormData(prevData => ({\n      ...prevData,\n      [fieldId]: value,\n    }));\n    if (errors[fieldId]) {\n      setErrors(prevErrors => {\n        const newErrors = { ...prevErrors };\n        delete newErrors[fieldId];\n        return newErrors;\n      });\n    }\n  };\n\n  const isFirstStep = currentStepIndex === 0;\n\n  const resetForm = () => {\n    setFormData({});\n    setErrors({});\n    setCurrentStepIndex(-1);\n  };\n\n  const setFormState = (state: FormState) => {\n    setCurrentStepIndex(state.currentStepIndex);\n    setFormData(state.formData);\n    setErrors({}); // Clear errors on restore\n  };\n\n  return {\n    currentStepIndex,\n    currentStep,\n    formData,\n    errors,\n    isWelcomeScreen,\n    isCompletionScreen,\n    isFormActive,\n    isFirstStep,\n    isLastStep,\n    steps,\n    startForm,\n    goToNextStep,\n    goToPreviousStep,\n    updateFormData,\n    resetForm,\n    validateStep,\n    setFormState,\n  };\n};\n","\nimport React from 'react';\n\nexport const CheckIcon: React.FC = () => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n    <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={3} d=\"M5 13l4 4L19 7\" />\n  </svg>\n);\n","import React, { useRef, useEffect } from 'react';\nimport { FormStep } from '../types';\nimport { CheckIcon } from './icons/CheckIcon';\n\ninterface ProgressBarProps {\n  steps: FormStep[];\n  currentStepIndex: number;\n}\n\nexport const ProgressBar: React.FC<ProgressBarProps> = ({ steps, currentStepIndex }) => {\n  const scrollContainerRef = useRef<HTMLDivElement>(null);\n  const stepRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n  // Effect to scroll the active step into the center of the view\n  useEffect(() => {\n    const activeStepElement = stepRefs.current[currentStepIndex];\n    const container = scrollContainerRef.current;\n\n    if (activeStepElement && container) {\n      const containerWidth = container.clientWidth;\n      const stepOffsetLeft = activeStepElement.offsetLeft;\n      const stepWidth = activeStepElement.offsetWidth;\n\n      // Calculate the scroll position to center the active step\n      const scrollLeft = stepOffsetLeft - (containerWidth / 2) + (stepWidth / 2);\n\n      container.scrollTo({\n        left: scrollLeft,\n        behavior: 'smooth',\n      });\n    }\n  }, [currentStepIndex]);\n\n\n  return (\n    <div ref={scrollContainerRef} className=\"w-full overflow-x-auto pb-3 scrollbar-hide\">\n      <div className=\"flex items-start justify-between my-6 flex-nowrap min-w-max px-4\">\n        {steps.map((step, index) => {\n          const isCompleted = index < currentStepIndex;\n          const isActive = index === currentStepIndex;\n\n          return (\n            <React.Fragment key={step.id}>\n              <div\n                // FIX: Changed ref callback from implicit return to block body to conform to Ref<T> type.\n                ref={el => { stepRefs.current[index] = el; }}\n                // Increased width to better fit longer step titles\n                className=\"flex flex-col items-center flex-shrink-0 w-32 text-center px-2\"\n              >\n                <div\n                  className={`w-8 h-8 sm:w-10 sm:h-10 rounded-full flex items-center justify-center transition-all duration-300 flex-shrink-0\n                    ${isCompleted ? 'bg-green-500 text-white' : ''}\n                    ${isActive ? 'bg-cyan-500 text-white scale-110' : ''}\n                    ${!isCompleted && !isActive ? 'bg-slate-700 text-slate-400 border-2 border-slate-600' : ''}\n                  `}\n                >\n                  {isCompleted ? <CheckIcon /> : <span>{index + 1}</span>}\n                </div>\n                <p className={`mt-2 text-xs transition-colors duration-300 ${isActive ? 'text-cyan-400 font-semibold' : 'text-slate-400'}`}>\n                  {step.title}\n                </p>\n              </div>\n              {index < steps.length - 1 && (\n                 <div className={`flex-1 h-1 rounded-full transition-colors duration-500 mt-4 sm:mt-5 ${isCompleted ? 'bg-green-500' : 'bg-slate-700'}`} style={{minWidth: '1.5rem'}}></div>\n              )}\n            </React.Fragment>\n          );\n        })}\n      </div>\n    </div>\n  );\n};","\nimport React from 'react';\nimport { FormField } from '../types';\n\ninterface FormControlProps {\n  field: FormField;\n  value: string;\n  otherValue?: string;\n  error?: string;\n  updateFormData: (fieldId: string, value: string) => void;\n}\n\nexport const FormControl: React.FC<FormControlProps> = ({ field, value, otherValue, error, updateFormData }) => {\n  const commonClasses = \"w-full px-4 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-cyan-500 transition-shadow\";\n  const errorClasses = \"border-red-500 ring-red-500\";\n  \n  const isOtherSelected = field.allowOther && (\n    (field.type === 'radio-group' && value === '__other__') ||\n    (field.type === 'checkbox-group' && value.includes('__other__'))\n  );\n\n  const handleCheckboxChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n    const { value: optionValue, checked } = e.target;\n    const currentValues = value ? value.split(',') : [];\n\n    let newValues;\n    if (checked) {\n      newValues = [...currentValues, optionValue];\n    } else {\n      newValues = currentValues.filter(v => v !== optionValue);\n    }\n    \n    const newValueString = newValues.filter(v => v).join(',');\n    updateFormData(field.id, newValueString);\n    \n    if (optionValue === '__other__' && !checked) {\n      updateFormData(`${field.id}_other`, '');\n    }\n  };\n\n  const handleRadioChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n    const newValue = e.target.value;\n    updateFormData(field.id, newValue);\n    if (value === '__other__' && newValue !== '__other__') {\n      updateFormData(`${field.id}_other`, '');\n    }\n  };\n\n  const renderInput = () => {\n    switch (field.type) {\n      case 'textarea':\n        return (\n          <textarea\n            id={field.id}\n            name={field.id}\n            value={value}\n            onChange={(e) => updateFormData(field.id, e.target.value)}\n            placeholder={field.placeholder}\n            required={field.required}\n            className={`${commonClasses} min-h-[100px] ${error ? errorClasses : ''}`}\n          />\n        );\n      case 'select':\n        return (\n          <select\n            id={field.id}\n            name={field.id}\n            value={value}\n            onChange={(e) => updateFormData(field.id, e.target.value)}\n            required={field.required}\n            className={`${commonClasses} ${error ? errorClasses : ''}`}\n          >\n            {field.options?.map(option => (\n              <option key={option.value} value={option.value} disabled={option.value === \"\"}>\n                {option.label}\n              </option>\n            ))}\n          </select>\n        );\n      case 'radio-group':\n      case 'checkbox-group':\n        const isRadio = field.type === 'radio-group';\n        const currentValues = value ? value.split(',') : [];\n\n        return (\n            <div className=\"space-y-2\">\n                {field.options?.map(option => (\n                    <div key={option.value} className=\"flex items-center\">\n                        <input\n                            type={isRadio ? 'radio' : 'checkbox'}\n                            id={`${field.id}-${option.value}`}\n                            name={field.id}\n                            value={option.value}\n                            checked={isRadio ? value === option.value : currentValues.includes(option.value)}\n                            onChange={isRadio ? handleRadioChange : handleCheckboxChange}\n                            className={isRadio ? \"form-radio h-4 w-4 text-cyan-600 bg-slate-700 border-slate-600 focus:ring-cyan-500\" : \"form-checkbox h-4 w-4 text-cyan-600 bg-slate-700 border-slate-600 rounded focus:ring-cyan-500\"}\n                        />\n                        <label htmlFor={`${field.id}-${option.value}`} className=\"ml-3 text-sm text-slate-300\">\n                            {option.label}\n                        </label>\n                    </div>\n                ))}\n                {field.allowOther && (\n                     <div className=\"flex items-center\">\n                        <input\n                            type={isRadio ? 'radio' : 'checkbox'}\n                            id={`${field.id}-__other__`}\n                            name={field.id}\n                            value=\"__other__\"\n                            checked={isRadio ? value === '__other__' : currentValues.includes('__other__')}\n                            onChange={isRadio ? handleRadioChange : handleCheckboxChange}\n                            className={isRadio ? \"form-radio h-4 w-4 text-cyan-600 bg-slate-700 border-slate-600 focus:ring-cyan-500\" : \"form-checkbox h-4 w-4 text-cyan-600 bg-slate-700 border-slate-600 rounded focus:ring-cyan-500\"}\n                        />\n                        <label htmlFor={`${field.id}-__other__`} className=\"ml-3 text-sm text-slate-300\">\n                            Other\n                        </label>\n                    </div>\n                )}\n                {isOtherSelected && (\n                    <div className=\"pl-7 pt-1\">\n                        <input\n                            type=\"text\"\n                            placeholder=\"Please specify\"\n                            value={otherValue}\n                            onChange={(e) => updateFormData(`${field.id}_other`, e.target.value)}\n                            className={`${commonClasses} text-sm`}\n                        />\n                    </div>\n                )}\n            </div>\n        );\n      default:\n        return (\n          <input\n            type={field.type}\n            id={field.id}\n            name={field.id}\n            value={value}\n            onChange={(e) => updateFormData(field.id, e.target.value)}\n            placeholder={field.placeholder}\n            required={field.required}\n            className={`${commonClasses} ${error ? errorClasses : ''}`}\n          />\n        );\n    }\n  };\n\n  return (\n    <div>\n      <label htmlFor={field.id} className=\"block text-sm font-medium text-slate-300 mb-2\">\n        {field.label}\n      </label>\n      {renderInput()}\n      {error && <p className=\"text-red-400 text-xs mt-1\">{error}</p>}\n    </div>\n  );\n};","\nimport React from 'react';\nimport { FormStep as FormStepType, FormData, FormErrors } from '../types';\nimport { FormControl } from './FormControl';\n\ninterface FormStepProps {\n  step: FormStepType;\n  formData: FormData;\n  errors: FormErrors;\n  updateFormData: (fieldId: string, value: string) => void;\n}\n\nexport const FormStep: React.FC<FormStepProps> = ({ step, formData, errors, updateFormData }) => {\n  return (\n    <div className=\"px-6 sm:px-8 pb-8\">\n      <h3 className=\"text-xl font-semibold text-white\">{step.title}</h3>\n      <p className=\"text-slate-400 mb-6 mt-1\">{step.description}</p>\n      <div className=\"space-y-6\">\n        {step.fields.map(field => (\n          <FormControl\n            key={field.id}\n            field={field}\n            value={formData[field.id] || ''}\n            otherValue={formData[`${field.id}_other`] || ''}\n            error={errors[field.id]}\n            updateFormData={updateFormData}\n          />\n        ))}\n      </div>\n    </div>\n  );\n};","import React from 'react';\nimport { FormConfig } from '../types';\n\ninterface WelcomeScreenProps {\n  content: FormConfig['welcome'];\n  onStart: () => void;\n}\n\nexport const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ content, onStart }) => {\n  return (\n    <div className=\"flex flex-col items-center justify-center text-center p-8\">\n      <h2 className=\"text-3xl font-bold text-white mb-3\">{content.title}</h2>\n      <p className=\"text-slate-300 max-w-md mb-8\">{content.description}</p>\n      <button\n        onClick={onStart}\n        className=\"px-6 py-3 bg-cyan-600 text-white rounded-lg font-semibold shadow-lg hover:bg-cyan-500 transition-all duration-300 transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-cyan-400 focus:ring-offset-2 focus:ring-offset-slate-900\"\n      >\n        {content.buttonText}\n      </button>\n    </div>\n  );\n};","import React from 'react';\n\nexport const PartyPopperIcon: React.FC = () => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M5.8 11.3 2 22l10.7-3.79\" />\n    <path d=\"M5.8 11.3 8 9l3.4 2.4-2.2 2.3z\" />\n    <path d=\"M12.4 2.6 14 1l6 6-1.6 1.6\" />\n    <path d=\"m14 1 3.4 2.4\" />\n    <path d=\"m20 7-3.4-2.4\" />\n    <path d=\"M12.4 2.6 14.6 5\" />\n    <path d=\"m18 11 2.4 3.4\" />\n    <path d=\"M15.4 15.4 18 18\" />\n    <path d=\"m5 2.5 3.5 3.5\" />\n  </svg>\n);\n","import React from 'react';\nimport { FormConfig, FormData } from '../types';\nimport { PartyPopperIcon } from './icons/PartyPopperIcon';\n\ninterface CompletionScreenProps {\n  content: FormConfig['completion'];\n  onRestart: () => void;\n  formData: FormData;\n}\n\nexport const CompletionScreen: React.FC<CompletionScreenProps> = ({ content, onRestart, formData }) => {\n  return (\n    <div className=\"flex flex-col items-center justify-center text-center p-8\">\n      <div className=\"w-16 h-16 bg-green-500/20 text-green-400 rounded-full flex items-center justify-center mb-4\">\n        <PartyPopperIcon />\n      </div>\n      <h2 className=\"text-3xl font-bold text-white mb-3\">{content.title}</h2>\n      <p className=\"text-slate-300 max-w-md mb-8\">{content.description}</p>\n      \n      {/* Optional: Display submitted data for review */}\n      <div className=\"bg-slate-900/50 rounded-lg p-4 w-full max-w-sm text-left text-sm mb-8 border border-slate-700\">\n        <h4 className=\"font-semibold text-cyan-400 mb-2\">Submission Summary:</h4>\n        <ul className=\"space-y-1 text-slate-300\">\n          {Object.entries(formData).map(([key, value]) => (\n            key !== 'password' && <li key={key}><strong className=\"font-medium text-slate-200 capitalize\">{key.replace(/([A-Z])/g, ' $1')}:</strong> {value}</li>\n          ))}\n        </ul>\n      </div>\n\n      <button\n        onClick={onRestart}\n        className=\"px-6 py-3 bg-slate-600 text-white rounded-lg font-semibold shadow-md hover:bg-slate-500 transition-all duration-300 transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-cyan-400 focus:ring-offset-2 focus:ring-offset-slate-900\"\n      >\n        {content.buttonText}\n      </button>\n    </div>\n  );\n};","\nimport React from 'react';\n\nexport const ArrowLeftIcon: React.FC = () => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n    <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M10 19l-7-7m0 0l7-7m-7 7h18\" />\n  </svg>\n);\n","\nimport React from 'react';\n\nexport const ArrowRightIcon: React.FC = () => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n    <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M14 5l7 7m0 0l-7 7m7-7H3\" />\n  </svg>\n);\n","import React, { useState, useEffect, useRef, useImperativeHandle, forwardRef } from 'react';\nimport { FormConfig, FormData, MultiStepFormHandle, FormState } from '../types';\nimport { useMultiStepForm } from '../hooks/useMultiStepForm';\nimport { ProgressBar } from './ProgressBar';\nimport { FormStep } from './FormStep';\nimport { WelcomeScreen } from './WelcomeScreen';\nimport { CompletionScreen } from './CompletionScreen';\nimport { ArrowLeftIcon } from './icons/ArrowLeftIcon';\nimport { ArrowRightIcon } from './icons/ArrowRightIcon';\nimport { CheckIcon } from './icons/CheckIcon';\n\ninterface MultiStepFormProps {\n  config: FormConfig;\n  onSubmit?: (formData: FormData) => void;\n}\n\nexport const MultiStepForm = forwardRef<MultiStepFormHandle, MultiStepFormProps>(({ config, onSubmit }, ref) => {\n  const {\n    currentStepIndex,\n    currentStep,\n    formData,\n    errors,\n    isWelcomeScreen,\n    isCompletionScreen,\n    isFormActive,\n    isFirstStep,\n    isLastStep,\n    steps,\n    startForm,\n    goToNextStep,\n    goToPreviousStep,\n    updateFormData,\n    resetForm,\n    setFormState,\n  } = useMultiStepForm(config, onSubmit);\n\n  const [containerHeight, setContainerHeight] = useState<number | 'auto'>('auto');\n  const stepRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n  useImperativeHandle(ref, () => ({\n    getState: (): FormState => ({\n      currentStepIndex,\n      formData,\n    }),\n    restoreState: (state: FormState) => {\n      setFormState(state);\n    },\n  }));\n\n  useEffect(() => {\n    // If we are on a form step, observe its height to animate the container\n    if (isFormActive && currentStepIndex >= 0) {\n      const currentStepElement = stepRefs.current[currentStepIndex];\n      \n      if (currentStepElement) {\n        const resizeObserver = new ResizeObserver(() => {\n          // When the observed element's size changes, update the container height\n          if (stepRefs.current[currentStepIndex]) {\n            setContainerHeight(stepRefs.current[currentStepIndex]!.offsetHeight);\n          }\n        });\n\n        resizeObserver.observe(currentStepElement);\n\n        // Set initial height\n        setContainerHeight(currentStepElement.offsetHeight);\n\n        return () => resizeObserver.disconnect();\n      }\n    } else {\n      // For Welcome and Completion screens, height is automatic.\n      setContainerHeight('auto');\n    }\n  }, [currentStepIndex, isFormActive, formData]); // formData dependency to recalculate on \"Other\" field appearance\n\n  return (\n    <div className=\"bg-slate-800/50 backdrop-blur-sm rounded-2xl shadow-2xl shadow-black/20 border border-slate-700 overflow-hidden\">\n      <div className=\"p-6 sm:p-8\">\n        <h2 className=\"text-2xl font-bold text-center text-cyan-400 mb-2\">{config.title}</h2>\n        {isFormActive && (\n          <ProgressBar steps={steps} currentStepIndex={currentStepIndex} />\n        )}\n      </div>\n\n      <div\n        className=\"relative overflow-hidden transition-[height] duration-500 ease-in-out\"\n        style={{ height: containerHeight }}\n      >\n        {isWelcomeScreen && (\n            <WelcomeScreen content={config.welcome} onStart={startForm} />\n        )}\n\n        {isCompletionScreen && (\n            <CompletionScreen content={config.completion} onRestart={resetForm} formData={formData} />\n        )}\n\n        {isFormActive &&\n          steps.map((step, index) => (\n            <div\n              key={step.id}\n              // FIX: Changed ref callback from implicit return to block body to conform to Ref<T> type.\n              ref={el => { stepRefs.current[index] = el; }}\n              className=\"absolute top-0 left-0 w-full transition-transform duration-500 ease-in-out\"\n              style={{\n                transform: `translateX(${(index - currentStepIndex) * 100}%)`,\n              }}\n              aria-hidden={index !== currentStepIndex}\n            >\n              <FormStep\n                step={step}\n                formData={formData}\n                errors={errors}\n                updateFormData={updateFormData}\n              />\n            </div>\n          ))}\n      </div>\n      \n      {isFormActive && (\n        <div className=\"bg-slate-900/50 p-6 flex justify-between items-center border-t border-slate-700\">\n          <button\n            onClick={goToPreviousStep}\n            disabled={isFirstStep}\n            className=\"flex items-center gap-2 px-4 py-2 bg-slate-600 text-white rounded-lg font-semibold shadow-md hover:bg-slate-500 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-300 transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-cyan-400 focus:ring-offset-2 focus:ring-offset-slate-900\"\n            aria-label=\"Go to previous step\"\n          >\n            <ArrowLeftIcon />\n            <span>Previous</span>\n          </button>\n          \n          <button\n            onClick={goToNextStep}\n            className={`flex items-center gap-2 px-4 py-2 text-white rounded-lg font-semibold shadow-md transition-all duration-300 transform hover:scale-105 focus:outline-none focus:ring-offset-2 focus:ring-offset-slate-900 ${\n              isLastStep\n                ? 'bg-green-600 hover:bg-green-500 focus:ring-2 focus:ring-green-400'\n                : 'bg-cyan-600 hover:bg-cyan-500 focus:ring-2 focus:ring-cyan-400'\n            }`}\n            aria-label={isLastStep ? 'Submit form' : 'Go to next step'}\n          >\n            <span>{isLastStep ? 'Submit' : 'Next'}</span>\n            {isLastStep ? <CheckIcon /> : <ArrowRightIcon />}\n          </button>\n        </div>\n      )}\n    </div>\n  );\n});","import { FormConfig } from '../types';\n\nexport function validateFormConfig(data: any): { isValid: boolean; errors: string[] } {\n  const errors: string[] = [];\n  if (!data) {\n    return { isValid: false, errors: ['Form configuration is null or undefined.'] };\n  }\n\n  // Check top-level properties\n  const topLevelKeys: (keyof FormConfig)[] = ['formId', 'title', 'welcome', 'completion', 'steps'];\n  for (const key of topLevelKeys) {\n    if (data[key] === undefined) errors.push(`Missing top-level property: \"${key}\".`);\n  }\n\n  if (!Array.isArray(data.steps)) {\n    errors.push('\"steps\" property must be an array.');\n    // Stop here if steps isn't an array, as subsequent checks will fail\n    return { isValid: errors.length === 0, errors };\n  }\n\n  // Check each step\n  data.steps.forEach((step: any, stepIndex: number) => {\n    if (!step.id) errors.push(`Step ${stepIndex + 1} is missing an \"id\".`);\n    if (!step.title) errors.push(`Step ${stepIndex + 1} (id: ${step.id || 'N/A'}) is missing a \"title\".`);\n    if (!Array.isArray(step.fields)) {\n      errors.push(`\"fields\" property in step (id: ${step.id || 'N/A'}) must be an array.`);\n      return; // Continue to next step if fields array is missing\n    }\n\n    // Check each field in the step\n    step.fields.forEach((field: any, fieldIndex: number) => {\n      if (!field.id) errors.push(`Field ${fieldIndex + 1} in step (id: ${step.id}) is missing an \"id\".`);\n      if (field.label === undefined) errors.push(`Field (id: ${field.id || 'N/A'}) is missing a \"label\".`);\n      if (!field.type) errors.push(`Field (id: ${field.id || 'N/A'}) is missing a \"type\".`);\n      if (field.required === undefined) errors.push(`Field (id: ${field.id || 'N/A'}) is missing a \"required\" property.`);\n\n      const optionBasedTypes = ['select', 'radio-group', 'checkbox-group'];\n      if (optionBasedTypes.includes(field.type)) {\n        if (!Array.isArray(field.options) || field.options.length === 0) {\n          errors.push(`Field (id: ${field.id}) is of type \"${field.type}\" but is missing or has an empty \"options\" array.`);\n        } else {\n          field.options.forEach((option: any, optionIndex: number) => {\n            if (typeof option.label === 'undefined' || typeof option.value === 'undefined') {\n              errors.push(`Option ${optionIndex + 1} for field (id: ${field.id}) is malformed. Missing \"label\" or \"value\".`);\n            }\n          });\n        }\n      }\n    });\n  });\n\n  return {\n    isValid: errors.length === 0,\n    errors,\n  };\n}\n"],"names":["useMultiStepForm","config","onSubmit","currentStepIndex","setCurrentStepIndex","useState","formData","setFormData","errors","setErrors","steps","useMemo","isWelcomeScreen","isCompletionScreen","isFormActive","currentStep","validateStep","step","newErrors","isValid","field","value","startForm","isLastStep","index","fieldId","prevData","prevErrors","state","CheckIcon","jsx","ProgressBar","scrollContainerRef","useRef","stepRefs","useEffect","activeStepElement","container","containerWidth","stepOffsetLeft","stepWidth","scrollLeft","isCompleted","isActive","jsxs","React","el","FormControl","otherValue","error","updateFormData","commonClasses","errorClasses","isOtherSelected","handleCheckboxChange","e","optionValue","checked","currentValues","newValues","v","newValueString","handleRadioChange","newValue","renderInput","option","isRadio","_b","FormStep","WelcomeScreen","content","onStart","PartyPopperIcon","CompletionScreen","onRestart","key","ArrowLeftIcon","ArrowRightIcon","MultiStepForm","forwardRef","ref","isFirstStep","goToNextStep","goToPreviousStep","resetForm","setFormState","containerHeight","setContainerHeight","useImperativeHandle","currentStepElement","resizeObserver","validateFormConfig","data","topLevelKeys","stepIndex","fieldIndex","optionIndex"],"mappings":"wIAGaA,EAAmB,CAACC,EAAoBC,IAA4C,CAC/F,KAAM,CAACC,EAAkBC,CAAmB,EAAIC,EAAAA,SAAS,EAAE,EACrD,CAACC,EAAUC,CAAW,EAAIF,EAAAA,SAAmB,CAAA,CAAE,EAC/C,CAACG,EAAQC,CAAS,EAAIJ,EAAAA,SAAqB,CAAA,CAAE,EAE7CK,EAAQC,EAAAA,QAAQ,IAAMV,EAAO,MAAO,CAACA,EAAO,KAAK,CAAC,EAElDW,EAAkBT,IAAqB,GACvCU,EAAqBV,IAAqBO,EAAM,OAChDI,EAAe,CAACF,GAAmB,CAACC,EAEpCE,EAAoCD,EAAeJ,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