@patreon/studio
Version:
Patreon Studio Design System
61 lines (60 loc) • 1.37 kB
TypeScript
import type { Placement } from '@floating-ui/react-dom';
export type BodySize = 'xs' | 'sm' | 'md' | 'lg';
export type HeadingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
export type Variant = 'visible' | 'default';
interface BaseProps {
/**
* An actionable error message to display when the input value is invalid
*/
error?: string;
/**
* Where to position the tooltip relative to the error icon
*/
errorPlacement?: Placement;
/**
* An accessible label for the input
*/
label: string;
/**
* A max length for the contents of the input
*/
maxLength?: number;
/**
* A form field name
*/
name?: string;
/**
* Blur handler
*/
onBlur?: () => void;
/**
* Focus handler
*/
onFocus?: () => void;
/**
* Change handler
*/
onChange: (value: string) => void;
/**
* A placeholder to display when there's no input value
*/
placeholder: string;
/**
* The value of the input
*/
value: string;
/**
* The variant for the implied input
*/
variant?: Variant;
}
interface BodyProps {
type: 'body';
size?: BodySize;
}
interface HeadingProps {
type: 'heading';
size?: HeadingSize;
}
export type ImpliedInputProps = (BaseProps & BodyProps) | (BaseProps & HeadingProps);
export {};