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

const DEFAULT_HTML: string | null = null;

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

export function TimePicker(props: TimePickerProps) {
  const { as, className, children, onChange, onOpen, onClose, defaultValue, format, minuteStep, placeholder, closeOnConfirm, placement, offset, ...rest } = props;
  const options = { defaultValue, format, minuteStep, placeholder, closeOnConfirm, placement, offset } as TimePickerOptions;

  return (
    <C42
      controller={TimePickerController}
      options={options}
      deps={[defaultValue, format, minuteStep, placeholder, closeOnConfirm, placement, offset]}
      events={{
        'timepicker:change': onChange,
        'timepicker:open': onOpen,
        'timepicker:close': onClose,
      }}
      as={(as as ElementType) ?? 'div'}
      className={className as string | undefined}
      html={DEFAULT_HTML ?? undefined}
      {...{ 'data-c42-time-picker': '' }}
      {...rest}
    >
      {children as ReactNode}
    </C42>
  );
}
