{"version":3,"sources":["../src/stepper.tsx"],"sourcesContent":["import type { CSSUIObject, ThemeProps } from \"@yamada-ui/core\"\nimport type { ReactNode } from \"react\"\nimport type { StepProps } from \"./step\"\nimport type { StepDescriptionProps } from \"./step-description\"\nimport type { StepSeparatorProps } from \"./step-separator\"\nimport type { StepStatusProps } from \"./step-status\"\nimport type { StepTitleProps } from \"./step-title\"\nimport type { UseStepperProps } from \"./use-stepper\"\nimport {\n  forwardRef,\n  omitThemeProps,\n  ui,\n  useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport { Step } from \"./step\"\nimport { StepDescription } from \"./step-description\"\nimport { StepSeparator } from \"./step-separator\"\nimport { StepStatus } from \"./step-status\"\nimport { StepTitle } from \"./step-title\"\nimport {\n  StepperDescendantsContextProvider,\n  StepperProvider,\n  useStepper,\n} from \"./use-stepper\"\n\ninterface StepItem extends Omit<StepProps, \"title\"> {\n  /**\n   * The description for step component.\n   */\n  description?: ReactNode\n  /**\n   * If true, display the step separator.\n   *\n   * @default true\n   */\n  hasSeparator?: boolean\n  /**\n   * The title for step component.\n   */\n  title?: ReactNode\n  /**\n   * Props for step description element.\n   */\n  descriptionProps?: StepDescriptionProps\n  /**\n   * Props for step separator element.\n   */\n  separatorProps?: StepSeparatorProps\n  /**\n   * Props for step status element.\n   */\n  statusProps?: StepStatusProps\n  /**\n   * Props for step title element.\n   */\n  titleProps?: StepTitleProps\n}\n\nexport type Steps = StepItem[]\n\ninterface StepperOptions {\n  /**\n   * If provided, generate step components based on steps.\n   */\n  steps?: Steps\n}\n\nexport interface StepperProps\n  extends ThemeProps<\"Stepper\">,\n    UseStepperProps,\n    StepperOptions {}\n\n/**\n * `Stepper` is a component that displays the progress of a multi-step process.\n *\n * @see Docs https://yamada-ui.com/components/navigation/stepper\n */\nexport const Stepper = forwardRef<StepperProps, \"div\">((props, ref) => {\n  const [styles, mergedProps] = useComponentMultiStyle(\"Stepper\", props)\n  const { className, children, steps, ...computedProps } =\n    omitThemeProps(mergedProps)\n\n  const { descendants, getContainerProps, ...rest } = useStepper(computedProps)\n\n  const computedChildren = useMemo(() => {\n    const hasChildren = children != null\n\n    if (hasChildren) {\n      return children\n    } else {\n      return steps?.map(\n        (\n          {\n            description,\n            hasSeparator = true,\n            title,\n            descriptionProps,\n            separatorProps,\n            statusProps,\n            titleProps,\n            ...rest\n          },\n          index,\n        ) => (\n          <Step key={index} {...rest}>\n            <StepStatus {...statusProps} />\n\n            <ui.div flexShrink={0}>\n              {title ? <StepTitle {...titleProps}>{title}</StepTitle> : null}\n              {description ? (\n                <StepDescription {...descriptionProps}>\n                  {description}\n                </StepDescription>\n              ) : null}\n            </ui.div>\n\n            {hasSeparator ? <StepSeparator {...separatorProps} /> : null}\n          </Step>\n        ),\n      )\n    }\n  }, [children, steps])\n\n  const css: CSSUIObject = { ...styles.stepper }\n\n  return (\n    <StepperDescendantsContextProvider value={descendants}>\n      <StepperProvider value={{ ...rest, styles }}>\n        <ui.div\n          className={cx(\"ui-stepper\", className)}\n          __css={css}\n          {...getContainerProps({}, ref)}\n        >\n          {computedChildren}\n        </ui.div>\n      </StepperProvider>\n    </StepperDescendantsContextProvider>\n  )\n})\n\nStepper.displayName = \"Stepper\"\nStepper.__ui__ = \"Stepper\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,eAAe;AA4FZ,cAEA,YAFA;AA5BL,IAAM,UAAU,WAAgC,CAAC,OAAO,QAAQ;AACrE,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,WAAW,KAAK;AACrE,QAAM,EAAE,WAAW,UAAU,OAAO,GAAG,cAAc,IACnD,eAAe,WAAW;AAE5B,QAAM,EAAE,aAAa,mBAAmB,GAAG,KAAK,IAAI,WAAW,aAAa;AAE5E,QAAM,mBAAmB,QAAQ,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