UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

40 lines (39 loc) 1.49 kB
import React from 'react'; import { BaseComponentProps } from '../internal/base-component'; import { NonCancelableEventHandler } from '../internal/events'; export interface AttributeEditorForwardRefType { <T>(props: AttributeEditorProps<T> & { ref?: React.Ref<AttributeEditorProps.Ref>; }): JSX.Element; } export declare namespace AttributeEditorProps { interface IsItemRemovableFunction<T> { (item: T): boolean; } type FieldRenderable<T> = (item: T, itemIndex: number) => React.ReactNode; interface FieldDefinition<T> { label?: React.ReactNode; info?: React.ReactNode; control?: FieldRenderable<T> | React.ReactNode; errorText?: FieldRenderable<T> | React.ReactNode; constraintText?: FieldRenderable<T> | React.ReactNode; } interface RemoveButtonClickDetail { itemIndex: number; } interface Ref { focusRemoveButton(itemIndex: number): void; } } export interface AttributeEditorProps<T> extends BaseComponentProps { empty?: React.ReactNode; additionalInfo?: React.ReactNode; addButtonText: string; removeButtonText: string; items?: ReadonlyArray<T>; isItemRemovable?: (item: T) => boolean; disableAddButton?: boolean; definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>; onAddButtonClick?: NonCancelableEventHandler; onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>; }