@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
139 lines (138 loc) • 4.82 kB
TypeScript
/**
* MSKCC DSM 2021, 2023
*/
import PropTypes from 'prop-types';
import React from 'react';
import { ReactAttr } from '../../types/common';
import { ButtonKind } from '../Button';
export interface FileUploaderButtonProps extends Omit<ReactAttr<HTMLButtonElement>, 'onChange' | 'tabIndex'> {
/**
* Specify the types of files that this input should be able to receive
*/
accept?: string[];
/**
* Specify the type of underlying button
*/
buttonKind?: ButtonKind;
/**
* Provide a custom className to be applied to the container node
*/
className?: string;
/**
* Specify whether you want to disable any updates to the FileUploaderButton
* label
*/
disableLabelChanges?: boolean;
/**
* Specify whether file input is disabled
*/
disabled?: boolean;
/**
* Provide a unique id for the underlying `<input>` node
*/
id?: string;
/**
* Provide the label text to be read by screen readers when interacting with
* this control
*/
labelText?: React.ReactNode;
/**
* Specify if the component should accept multiple files to upload
*/
multiple?: boolean;
/**
* Provide a name for the underlying `<input>` node
*/
name?: string;
/**
* Provide an optional `onChange` hook that is called each time the `<input>`
* value changes
*/
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
/**
* Provide an optional `onClick` hook that is called each time the button is
* clicked
*/
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
/**
* Provide an accessibility role for the `<FileUploaderButton>`
*/
role?: string;
/**
* Specify the size of the FileUploaderButton, from a list of available
* sizes.
*/
size?: 'sm' | 'md' | 'lg';
/**
* @deprecated The `tabIndex` prop for `FileUploaderButton` has been deprecated since it now renders a button element by default.
*/
tabIndex?: number | string;
innerRef?: React.RefObject<HTMLLabelElement>;
}
declare function FileUploaderButton({ accept, buttonKind, className, disabled, disableLabelChanges, id, labelText: ownerLabelText, multiple, onChange, name, size, innerRef, ...other }: FileUploaderButtonProps): JSX.Element;
declare namespace FileUploaderButton {
var propTypes: {
/**
* Specify the types of files that this input should be able to receive
*/
accept: PropTypes.Requireable<(string | null | undefined)[]>;
/**
* Specify the type of underlying button
*/
buttonKind: PropTypes.Requireable<"primary" | "secondary" | "danger" | "ghost" | "danger--primary" | "danger--ghost" | "danger--tertiary" | "tertiary">;
/**
* Provide a custom className to be applied to the container node
*/
className: PropTypes.Requireable<string>;
/**
* Specify whether you want to disable any updates to the FileUploaderButton
* label
*/
disableLabelChanges: PropTypes.Requireable<boolean>;
/**
* Specify whether file input is disabled
*/
disabled: PropTypes.Requireable<boolean>;
/**
* Provide a unique id for the underlying `<input>` node
*/
id: PropTypes.Requireable<string>;
/**
* Provide the label text to be read by screen readers when interacting with
* this control
*/
labelText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/**
* Specify if the component should accept multiple files to upload
*/
multiple: PropTypes.Requireable<boolean>;
/**
* Provide a name for the underlying `<input>` node
*/
name: PropTypes.Requireable<string>;
/**
* Provide an optional `onChange` hook that is called each time the `<input>`
* value changes
*/
onChange: PropTypes.Requireable<(...args: any[]) => any>;
/**
* Provide an optional `onClick` hook that is called each time the button is
* clicked
*/
onClick: PropTypes.Requireable<(...args: any[]) => any>;
/**
* Provide an accessibility role for the `<FileUploaderButton>`
*/
role: PropTypes.Requireable<string>;
/**
* Specify the size of the FileUploaderButton, from a list of available
* sizes.
*/
size: PropTypes.Requireable<string>;
/**
* Provide a custom tabIndex value for the `<FileUploaderButton>`
*/
tabIndex: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
};
}
export default FileUploaderButton;