UNPKG

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