@payfit/unity-components
Version:
39 lines (38 loc) • 1.89 kB
TypeScript
import { ReactNode } from 'react';
import { UnityIcon } from '@payfit/unity-icons';
import { TagProps } from 'react-aria-components/TagGroup';
export type AIComposerAttachmentProps = Omit<TagProps, 'children' | 'className' | 'style'> & {
children: ReactNode;
/** Identifies the attachment type before its name. */
icon: UnityIcon;
/** Limits the visible attachment name without changing its accessible text. */
maxCharactersTruncation?: number;
/** Adds styling to the attachment tag. */
className?: string;
};
/**
* Keeps each selected file identifiable and removable while preserving space
* for the prompt.
*
* Render it inside `AIComposerAttachmentsGroup` with a stable `id` and the
* full filename as children. Pass `textValue` when children are not a plain
* string, and use `maxCharactersTruncation` only to shorten the visual label.
* @param props - Attachment text, icon, and React Aria tag props.
* @param props.icon - Identifies the attachment type before its name.
* @param props.maxCharactersTruncation - Sets the visible-name limit. Defaults
* to `12` while preserving the complete accessible filename.
* @see {@link AIComposerAttachmentProps} for all available props.
* @remarks
* The attachment receives React Aria tag semantics and a localized remove
* control. It disables itself while the parent Composer is `disabled` or
* `loading`.
*/
export declare const AIComposerAttachment: import('react').ForwardRefExoticComponent<Omit<TagProps, "children" | "className" | "style"> & {
children: ReactNode;
/** Identifies the attachment type before its name. */
icon: UnityIcon;
/** Limits the visible attachment name without changing its accessible text. */
maxCharactersTruncation?: number;
/** Adds styling to the attachment tag. */
className?: string;
} & import('react').RefAttributes<HTMLDivElement>>;