{"version":3,"file":"StepFormDialogProvider.cjs","sources":["../../../../src/components/Dialog/ControlledStepFormDialog/StepFormDialogProvider.tsx"],"sourcesContent":["'use client'\n\nimport {\n  type FC,\n  type MutableRefObject,\n  type ReactNode,\n  type RefObject,\n  createContext,\n  useRef,\n  useState,\n} from 'react'\n\nexport type StepItem = {\n  /** StepのID */\n  id: string\n  /** 何ステップ目か */\n  stepNumber: number\n}\n\ntype StepFormDialogContextType = {\n  stepQueue: MutableRefObject<StepItem[]>\n  currentStep: StepItem\n  setCurrentStep: (step: StepItem) => void\n  scrollerRef: RefObject<HTMLDivElement>\n}\nexport const StepFormDialogContext = createContext<StepFormDialogContextType>({\n  stepQueue: { current: [] },\n  currentStep: { id: '', stepNumber: 0 },\n  setCurrentStep: () => {},\n  scrollerRef: { current: null },\n})\n\ntype Props = {\n  children: ReactNode\n  firstStep: StepItem\n}\nexport const StepFormDialogProvider: FC<Props> = ({ children, firstStep }) => {\n  const [currentStep, setCurrentStep] = useState<StepItem>(firstStep)\n  const stepQueue = useRef<StepItem[]>([])\n  const scrollerRef = useRef<HTMLDivElement>(null)\n\n  return (\n    <StepFormDialogContext.Provider value={{ currentStep, stepQueue, setCurrentStep, scrollerRef }}>\n      {children}\n    </StepFormDialogContext.Provider>\n  )\n}\n"],"names":[],"mappings":";;;;;;AAyBO;AACL;;AAEA;AACA;AACD;AAMM;;AAEL;AACA;;AAOF;;;"}