UNPKG

3.3 kBTypeScriptView Raw
1import * as React from "react";
2import type { IconName } from "@blueprintjs/icons";
3import { Intent } from "./intent";
4export declare const DISPLAYNAME_PREFIX = "Blueprint5";
5/**
6 * Alias for all valid HTML props for `<div>` element.
7 * Does not include React's `ref` or `key`.
8 */
9export 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 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 type MaybeElement = JSX.Element | false | null | undefined;
21/**
22 * A shared base interface for all Blueprint component props.
23 */
24export interface Props {
25 /** A space-delimited list of class names to pass along to a child element. */
26 className?: string;
27}
28export interface IntentProps {
29 /** Visual intent color to apply to element. */
30 intent?: Intent;
31}
32/**
33 * Interface for a clickable action, such as a button or menu item.
34 * These props can be spready directly to a `<Button>` or `<MenuItem>` element.
35 *
36 * @template T type of the DOM element rendered by this component
37 */
38export interface ActionProps<T extends HTMLElement = HTMLElement> extends IntentProps, Props {
39 /** Whether this action is non-interactive. */
40 disabled?: boolean;
41 /** Name of a Blueprint UI icon (or an icon element) to render before the text. */
42 icon?: IconName | MaybeElement;
43 /** Click event handler. */
44 onClick?: (event: React.MouseEvent<T>) => void;
45 /** Focus event handler. */
46 onFocus?: (event: React.FocusEvent<T>) => void;
47 /** Action text. Can be any single React renderable. */
48 text?: React.ReactNode;
49}
50/** Interface for a link, with support for customizing target window. */
51export interface LinkProps {
52 /** Link URL. */
53 href?: string;
54 /** Link target attribute. Use `"_blank"` to open in a new window. */
55 target?: React.HTMLAttributeAnchorTarget;
56}
57/**
58 * Interface for a controlled input.
59 */
60export interface ControlledProps {
61 /** Initial value of the input, for uncontrolled usage. */
62 defaultValue?: string;
63 /** Form value of the input, for controlled usage. */
64 value?: string;
65}
66export interface OptionProps extends Props {
67 /** Whether this option is non-interactive. */
68 disabled?: boolean;
69 /** Label text for this option. If omitted, `value` is used as the label. */
70 label?: string;
71 /** Value of this option. */
72 value: string | number;
73}
74/**
75 * Typically applied to HTMLElements to filter out disallowed props. When applied to a Component,
76 * can filter props from being passed down to the children. Can also filter by a combined list of
77 * supplied prop keys and the denylist (only appropriate for HTMLElements).
78 *
79 * @param props The original props object to filter down.
80 * @param {string[]} invalidProps If supplied, overwrites the default denylist.
81 * @param {boolean} shouldMerge If true, will merge supplied invalidProps and denylist together.
82 */
83export declare function removeNonHTMLProps(props: {
84 [key: string]: any;
85}, invalidProps?: string[], shouldMerge?: boolean): {
86 [key: string]: any;
87};