import { ReactNode } from 'react'; import Box from './Box'; import Button from './Button'; import Flex from './Flex'; import useResponsiveMinWidth from './useResponsiveMinWidth'; type Props = { /** * Contents of the form, typically input components like [TextField](https://gestalt.pinterest.systems/web/textfield) or [NumberField](https://gestalt.pinterest.systems/web/numberfield). */ children: ReactNode; /** * Callback triggered when the form is submitted. */ onSubmit: (arg1: { event: | React.MouseEvent | React.MouseEvent | React.KeyboardEvent | React.KeyboardEvent; }) => void; /** * Text content of the submit button. Be sure to localize! */ submitButtonText: string; /** * Label for the submit button used for screen readers. Should follow the [Accessibility guidelines](https://gestalt.pinterest.systems/web/bannerupsell#Accessibility). Be sure to localize! */ submitButtonAccessibilityLabel: string; /** * Used to disable the submit button. */ submitButtonDisabled?: boolean; }; /** * [BannerUpsell.Form](https://gestalt.pinterest.systems/web/bannerupsell#BannerUpsell.Form) can be used to add a short form to BannerUpsell for collecting data from the user. */ export default function BannerUpsellForm({ children, onSubmit, submitButtonText, submitButtonAccessibilityLabel, submitButtonDisabled, }: Props) { const responsiveMinWidth = useResponsiveMinWidth(); const isXsWidth = responsiveMinWidth === 'xs'; return ( // @ts-expect-error - TS2322 - Type 'FormEvent' is not assignable to type 'MouseEvent | KeyboardEvent | MouseEvent | KeyboardEvent<...>'.
onSubmit({ event })} style={{ width: '100%' }}> {children}