@primer/react
Version:
An implementation of GitHub's Primer Design System using React
55 lines (54 loc) • 2.67 kB
TypeScript
import { Merge } from "../utils/types/Merge.js";
import { ForwardRefComponent } from "../utils/polymorphic.js";
import { ButtonProps } from "../Button/types.js";
import { StyledWrapperProps } from "../internal/components/TextInputWrapper.js";
import React from "react";
//#region src/TextInput/TextInput.d.ts
type TextInputNonPassthroughProps = {
/** @deprecated Use `leadingVisual` or `trailingVisual` prop instead */icon?: React.ElementType; /** Whether the to show a loading indicator in the input */
loading?: boolean;
/**
* Which position to render the loading indicator
* 'auto' (default): at the end of the input, unless a `leadingVisual` is passed. Then, it will render at the beginning
* 'leading': at the beginning of the input
* 'trailing': at the end of the input
**/
loaderPosition?: 'auto' | 'leading' | 'trailing'; /** Text for screen readers to convey the loading state */
loaderText?: string;
/**
* A visual that renders inside the input before the typing area
*/
leadingVisual?: React.ElementType | React.ReactNode;
/**
* A visual that renders inside the input after the typing area
*/
trailingVisual?: React.ElementType | React.ReactNode;
/**
* A visual that renders inside the input after the typing area
*/
trailingAction?: React.ReactElement<React.HTMLProps<HTMLButtonElement>>;
/**
* Optional character limit for the input. If provided, a character counter will be displayed below the input.
* When the limit is exceeded, validation styling will be applied.
*/
characterLimit?: number;
/**
* Stable identifier for the underlying input element.
*
* TODO: next-major: Remove in favor of data-component="TextInput.Input"
*/
'data-component'?: string;
} & Partial<Pick<StyledWrapperProps, 'block' | 'contrast' | 'disabled' | 'monospace' | 'width' | 'maxWidth' | 'minWidth' | 'variant' | 'size' | 'validationStatus'>>;
type TextInputProps = Merge<React.ComponentPropsWithoutRef<'input'>, TextInputNonPassthroughProps>;
declare const _default: ForwardRefComponent<"input", TextInputProps> & {
__SLOT__: symbol;
Action: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label" | "size" | "tooltipDirection"> & {
children?: React.ReactNode;
"aria-label"?: string;
tooltipDirection?: "n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw";
icon?: React.FunctionComponent<React.PropsWithChildren<import("@primer/octicons-react").IconProps>>;
variant?: ButtonProps["variant"];
} & React.RefAttributes<HTMLButtonElement>>;
};
//#endregion
export { TextInputNonPassthroughProps, TextInputProps, _default as default };