UNPKG

4.44 kBTypeScriptView Raw
1import * as React from "react";
2import { IconName } from "@blueprintjs/icons";
3import { Intent } from "./intent";
4import { IRef } from "./refs";
5export declare const DISPLAYNAME_PREFIX = "Blueprint3";
6/**
7 * Alias for all valid HTML props for `<div>` element.
8 * Does not include React's `ref` or `key`.
9 */
10export declare type HTMLDivProps = React.HTMLAttributes<HTMLDivElement>;
11/**
12 * Alias for all valid HTML props for `<input>` element.
13 * Does not include React's `ref` or `key`.
14 */
15export declare type HTMLInputProps = React.InputHTMLAttributes<HTMLInputElement>;
16/**
17 * Alias for a `JSX.Element` or a value that renders nothing.
18 *
19 * In React, `boolean`, `null`, and `undefined` do not produce any output.
20 */
21export declare type MaybeElement = JSX.Element | false | null | undefined;
22/**
23 * A shared base interface for all Blueprint component props.
24 *
25 * @deprecated use Props
26 */
27export interface IProps {
28 /** A space-delimited list of class names to pass along to a child element. */
29 className?: string;
30}
31export declare type Props = IProps;
32/** @deprecated use IntentProps */
33export interface IIntentProps {
34 /** Visual intent color to apply to element. */
35 intent?: Intent;
36}
37export declare type IntentProps = IIntentProps;
38/**
39 * Interface for a clickable action, such as a button or menu item.
40 * These props can be spready directly to a `<Button>` or `<MenuItem>` element.
41 *
42 * @deprecated use ActionProps
43 */
44export interface IActionProps extends IntentProps, Props {
45 /** Whether this action is non-interactive. */
46 disabled?: boolean;
47 /** Name of a Blueprint UI icon (or an icon element) to render before the text. */
48 icon?: IconName | MaybeElement;
49 /** Click event handler. */
50 onClick?: (event: React.MouseEvent<HTMLElement>) => void;
51 /** Action text. Can be any single React renderable. */
52 text?: React.ReactNode;
53}
54export declare type ActionProps = IActionProps;
55/**
56 * Interface for a link, with support for customizing target window.
57 *
58 * @deprecated use LinkProps
59 */
60export interface ILinkProps {
61 /** Link URL. */
62 href?: string;
63 /** Link target attribute. Use `"_blank"` to open in a new window. */
64 target?: string;
65}
66export declare type LinkProps = ILinkProps;
67/**
68 * Interface for a controlled input.
69 *
70 * @deprecated use IControlledProps2.
71 */
72export interface IControlledProps {
73 /** Initial value of the input, for uncontrolled usage. */
74 defaultValue?: string;
75 /** Change event handler. Use `event.target.value` for new value. */
76 onChange?: React.FormEventHandler<HTMLElement>;
77 /** Form value of the input, for controlled usage. */
78 value?: string;
79}
80export interface IControlledProps2 {
81 /** Initial value of the input, for uncontrolled usage. */
82 defaultValue?: string;
83 /** Form value of the input, for controlled usage. */
84 value?: string;
85}
86export declare type ControlledProps2 = IControlledProps2;
87/**
88 * @deprecated will be removed in Blueprint v4.0, where components will use `ref` prop instead
89 */
90export interface IElementRefProps<E extends HTMLElement> {
91 /** A ref handler or a ref object that receives the native HTML element rendered by this component. */
92 elementRef?: IRef<E>;
93}
94/**
95 * An interface for an option in a list, such as in a `<select>` or `RadioGroup`.
96 * These props can be spread directly to an `<option>` or `<Radio>` element.
97 *
98 * @deprecated use OptionProps
99 */
100export interface IOptionProps extends Props {
101 /** Whether this option is non-interactive. */
102 disabled?: boolean;
103 /** Label text for this option. If omitted, `value` is used as the label. */
104 label?: string;
105 /** Value of this option. */
106 value: string | number;
107}
108export declare type OptionProps = IOptionProps;
109/**
110 * Typically applied to HTMLElements to filter out disallowed props. When applied to a Component,
111 * can filter props from being passed down to the children. Can also filter by a combined list of
112 * supplied prop keys and the denylist (only appropriate for HTMLElements).
113 *
114 * @param props The original props object to filter down.
115 * @param {string[]} invalidProps If supplied, overwrites the default denylist.
116 * @param {boolean} shouldMerge If true, will merge supplied invalidProps and denylist together.
117 */
118export declare function removeNonHTMLProps(props: {
119 [key: string]: any;
120}, invalidProps?: string[], shouldMerge?: boolean): {
121 [key: string]: any;
122};