// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand.
// Source: packages/core/manifest.json (component "stepper").
import type { ElementType, ReactNode } from 'react';
import { Stepper as StepperController, type StepperOptions } from '@42/core/stepper';
import { C42 } from '../C42';

const DEFAULT_HTML: string | null = "<div data-c42-stepper-step data-value=\"1\">\n    <span data-c42-stepper-indicator></span>\n    <button data-c42-stepper-trigger>Step 1</button>\n    <div data-c42-stepper-panel>Content for step 1</div>\n  </div>\n  <div data-c42-stepper-step data-value=\"2\">\n    <span data-c42-stepper-indicator></span>\n    <button data-c42-stepper-trigger>Step 2</button>\n    <div data-c42-stepper-panel>Content for step 2</div>\n  </div>";

export interface StepperProps extends Partial<StepperOptions> {
  /** Element/tag rendered as the controller root. Defaults to `"div"`. */
  as?: ElementType;
  className?: string;
  children?: ReactNode;
  /** Fired on `stepper:change` — detail: `{ value, index }` */
  onChange?: (detail: unknown, event: CustomEvent) => void;
  /** Extra props are forwarded to the rendered `<div>` element. */
  [key: string]: unknown;
}

export function Stepper(props: StepperProps) {
  const { as, className, children, onChange, linear, defaultValue, ...rest } = props;
  const options = { linear, defaultValue } as StepperOptions;

  return (
    <C42
      controller={StepperController}
      options={options}
      deps={[linear, defaultValue]}
      events={{
        'stepper:change': onChange,
      }}
      as={(as as ElementType) ?? 'div'}
      className={className as string | undefined}
      html={DEFAULT_HTML ?? undefined}
      {...{ 'data-c42-stepper': '' }}
      {...rest}
    >
      {children as ReactNode}
    </C42>
  );
}
