// This file was generated by build-components.mjs
// ANY EDITS WILL BE OVERWRITTEN!

import {
  UploadButton as PreactUploadButton,
  type UploadButtonProps,
} from '@uppy/components'
import { h as preactH } from 'preact'
import { render as preactRender } from 'preact/compat'
import { createElement as h, useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

export default function UploadButton(props: Omit<UploadButtonProps, 'ctx'>) {
  const ref = useRef(null)
  const ctx = useContext(UppyContext)

  useEffect(() => {
    if (ref.current) {
      preactRender(
        preactH(PreactUploadButton, {
          ...props,
          ctx,
        } satisfies UploadButtonProps),
        ref.current,
      )
    }
  }, [ctx, props])

  return <div ref={ref} />
}
