@payfit/unity-components
Version:
37 lines (36 loc) • 1.99 kB
TypeScript
import { PressEvent } from 'react-aria-components';
import { AIComposerActionProps } from './AIComposerAction.js';
export interface AIComposerSubmitActionProps extends Omit<AIComposerActionProps, 'icon' | 'className' | 'style'> {
/** Names the send action while the Composer is ready for a prompt. */
sendAriaLabel?: string;
/** Names the pending action while the Composer uses `state="loading"`. */
loadingAriaLabel?: string;
/** Names the stop action while the Composer uses `state="streaming"`. */
stopAriaLabel?: string;
/** Overrides default form submission outside the `streaming` state. */
onPress?: (event: PressEvent) => void;
}
/**
* Gives people a consistently named primary action for sending a prompt or
* stopping an AI response.
*
* Render it in the `right` region of `AIComposerActions`. Without `onPress`,
* it submits the parent Composer form; during `state="streaming"`, it calls
* the parent `onStop` callback instead. Pass `sendAriaLabel`,
* `loadingAriaLabel`, or `stopAriaLabel` when the default
* state-specific names are not suitable.
* @param props - Accessible action props and optional custom press behavior.
* @param props.sendAriaLabel - Names the ready-to-send action. Defaults to
* `Send message`.
* @param props.loadingAriaLabel - Names the loading action. Defaults to
* `Sending message`.
* @param props.stopAriaLabel - Names the streaming stop action. Defaults to
* `Stop generating`.
* @param props.onPress - Replaces default form submission outside streaming.
* @see {@link AIComposerSubmitActionProps} for all available props.
* @remarks
* The action is disabled during `loading` and inherits `disabled` from the
* parent Composer. It remains a stop control during `streaming` even when an
* `onPress` callback is supplied.
*/
export declare const AIComposerSubmitAction: import('react').ForwardRefExoticComponent<AIComposerSubmitActionProps & import('react').RefAttributes<HTMLButtonElement>>;