goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
51 lines • 2.34 kB
TypeScript
import { default as React } from 'react';
import { FieldStyleOverrides } from '../Shell';
export interface PercentageFieldProps {
/** Seed for the uncontrolled display (default '0'). Ignored once `value` is set. */
initialValue?: string | number;
/** Controlled value as a string; drives the display verbatim when set. */
value?: string;
/**
* Canonical numeric onChange. Always called with the parsed numeric
* value — increment/decrement, typed input, and native input
* callbacks all funnel through this single shape.
*/
onChange?: (value: number) => void;
label?: string;
/** Lower clamp for typed and stepped values (default 0). */
min?: number;
/** Upper clamp for typed and stepped values (default 100). */
max?: number;
/** Amount added/removed per +/- press (default 1). */
step?: number;
/** Milliseconds a +/- button is held before auto-repeat kicks in (default 500). */
initialDelay?: number;
/** Milliseconds between auto-repeat steps while a +/- button stays held (default 100). */
repeatInterval?: number;
/** Appends '%' to the displayed value (default true); `onChange` still emits the bare number. */
showPercentSymbol?: boolean;
placeholder?: string;
id?: string;
helperText?: string;
/** Error message rendered below the input; sets aria-invalid. */
error?: string | boolean;
/** Stable test selector — emitted as `data-field` on the wrapper. */
dataField?: string;
/** Stable test selector — emitted as `data-field-name` on the wrapper. */
dataFieldName?: string;
/** Forwarded to the input as `name` for native form submission. */
name?: string;
/** Per-instance style overrides. */
styles?: FieldStyleOverrides;
}
/**
* Percentage entry built on FieldShell: an auto-width numeric input that
* appends a % symbol, with stacked +/- buttons that auto-repeat while held.
* Typed input is stripped to digits and clamped to [min, max]; `onChange`
* emits the parsed number — not a DOM event. Auto-binds by `name` inside a
* goobs `<Form>` (the engine stores the number); otherwise the string `value`
* prop controls the display.
*/
declare const PercentageField: React.FC<PercentageFieldProps>;
export default PercentageField;
//# sourceMappingURL=index.d.ts.map