UNPKG

@octopusdeploy/design-system-components

Version:
99 lines (98 loc) 3.23 kB
import React from "react"; import type { FormFieldProps } from "../FormFieldProps"; export interface TextOtherProps { maxLength?: number; autoFocus?: boolean; autoComplete?: string; type?: string; min?: number; max?: number; placeholder?: string; hideUnderline?: boolean; id?: string; multiline?: boolean; minRows?: number; maxRows?: number; style?: React.CSSProperties; applyMaxWidth?: boolean; disabled?: boolean; readOnly?: boolean; label?: string | JSX.Element; accessibleName?: string; error?: string; warning?: string | null; className?: string; showBorder?: boolean; monoSpacedFont?: boolean; showValueAsTitleAttribute?: boolean; name?: string; generateUniqueName?: boolean; usePlaceholderAsLabel?: boolean; customMargins?: string; helperText?: string | JSX.Element; inputProps?: { startAdornment?: React.ReactNode; endAdornment?: React.ReactNode; "aria-label"?: string; "aria-placeholder"?: string; classes?: { root?: string; input?: string; }; disableUnderline?: boolean; }; margin?: "none" | "dense" | "normal"; textInputRef?(textInput: TextInput | null): void; inputContainerRef?(inputWrapper: HTMLDivElement | null): void; validate?(value: string): string; onValidate?(value: string): void; onKeyPress?: React.KeyboardEventHandler<HTMLDivElement>; onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>; onFocus?: React.FocusEventHandler<HTMLInputElement>; onBlur?: React.FocusEventHandler<HTMLInputElement>; onClick?: React.MouseEventHandler<HTMLDivElement>; } export type TextProps = TextOtherProps & FormFieldProps<string>; interface TextState { error?: string; showExternalError: boolean; } interface Selection { start: number | null; end: number | null; } export interface TextInput { isFocused(): boolean; focus(): void; blur(): void; select(): void; getSelection(): Selection; insertAtCursor(value: string): void; setValueAndSelection(selection: Selection, value: string): void; } export declare class Text extends React.Component<TextProps, TextState> implements TextInput { static defaultProps: Partial<TextProps>; private textFieldInput; private genericName; private uniqueId; constructor(props: TextProps); UNSAFE_componentWillMount(): void; componentWillUnmount(): void; UNSAFE_componentWillReceiveProps(nextProps: TextProps): void; getSelection: () => { start: number | null; end: number | null; }; setValueAndSelection: (selection: Selection, value: string) => void; isFocused(): boolean; select(): void; focus(): void; blur(): void; insertAtCursor(value: string): void; handleChange: (event: React.SyntheticEvent<HTMLInputElement | HTMLTextAreaElement>) => void; callValidateAndChange: (value: string) => void; handleKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => void; handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void; render(): import("react/jsx-runtime").JSX.Element; } export {};