UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

38 lines (35 loc) 1.61 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { HTMLInputTypeAttribute, InputHTMLAttributes } from 'react'; import { UseDelayOptions } from '../../hooks/useDelay.mjs'; type InputProps = { /** * The value */ value: string; /** * @default 'text' */ type?: HTMLInputTypeAttribute; /** * Callback for when the input's value changes * This is pretty much required but made optional for the rare cases where it actually isn't need such as when used with disabled * That could be enforced through a union type but that seems a bit overkill * @default noop */ onChangeText?: (text: string) => void; onEditCompleted?: (text: string) => void; labelClassName?: string; initialState?: 'editing' | 'display'; size?: number; disclaimer?: string; saveDelayOptions?: UseDelayOptions; } & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'label' | 'type' | 'crossOrigin'>; /** * A Text input component for inputting text. It changes appearance upon entering the edit mode and switches * back to display mode on loss of focus or on enter * * The State is managed by the parent */ declare const ToggleableInput: ({ type, value, onChange, onChangeText, onEditCompleted, labelClassName, initialState, size, disclaimer, onBlur, saveDelayOptions, ...restProps }: InputProps) => react_jsx_runtime.JSX.Element; declare const ToggleableInputUncontrolled: ({ value: initialValue, onChangeText, ...restProps }: InputProps) => react_jsx_runtime.JSX.Element; export { ToggleableInput, ToggleableInputUncontrolled };