UNPKG

2.11 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent2 } from "../../common";
3import { Props } from "../../common/props";
4export declare type FileInputProps = IFileInputProps;
5/** @deprecated use FileInputProps */
6export interface IFileInputProps extends React.LabelHTMLAttributes<HTMLLabelElement>, Props {
7 /**
8 * Whether the file input is non-interactive.
9 * Setting this to `true` will automatically disable the child input too.
10 */
11 disabled?: boolean;
12 /**
13 * Whether the file input should take up the full width of its container.
14 */
15 fill?: boolean;
16 /**
17 * Whether the user has made a selection in the input. This will affect the component's
18 * text styling. Make sure to set a non-empty value for the text prop as well.
19 *
20 * @default false
21 */
22 hasSelection?: boolean;
23 /**
24 * The props to pass to the child input.
25 * `disabled` will be ignored in favor of the top-level prop.
26 * `type` will be ignored, because the input _must_ be `type="file"`.
27 * Pass `onChange` here to be notified when the user selects a file.
28 */
29 inputProps?: React.HTMLProps<HTMLInputElement>;
30 /**
31 * Whether the file input should appear with large styling.
32 */
33 large?: boolean;
34 /**
35 * Callback invoked on `<input>` `change` events.
36 *
37 * This callback is offered as a convenience; it is equivalent to passing
38 * `onChange` to `inputProps`.
39 *
40 * __Note:__ The top-level `onChange` prop is passed to the wrapping
41 * `<label>` rather than the `<input>`, which may not be what you expect.
42 */
43 onInputChange?: React.FormEventHandler<HTMLInputElement>;
44 /**
45 * The text to display.
46 *
47 * @default "Choose file..."
48 */
49 text?: React.ReactNode;
50 /**
51 * The button text.
52 *
53 * @default "Browse"
54 */
55 buttonText?: string;
56}
57export declare class FileInput extends AbstractPureComponent2<FileInputProps> {
58 static displayName: string;
59 static defaultProps: FileInputProps;
60 render(): JSX.Element;
61 private handleInputChange;
62}