import * as React from "react" ; import { IconName } from "@blueprintjs/icons" ; import { Intent } from "./intent" ; import { IRef } from "./refs" ; export const DISPLAYNAME_PREFIX = "Blueprint3" ; /**
 * Alias for all valid HTML props for `<div>` element.
 * Does not include React's `ref` or `key`.
 */ export type HTMLDivProps = React . HTMLAttributes < HTMLDivElement > ; /**
 * Alias for all valid HTML props for `<input>` element.
 * Does not include React's `ref` or `key`.
 */ export type HTMLInputProps = React . InputHTMLAttributes < HTMLInputElement > ; /**
 * Alias for a `JSX.Element` or a value that renders nothing.
 *
 * In React, `boolean`, `null`, and `undefined` do not produce any output.
 */ export type MaybeElement = JSX . Element | false | null | undefined ; deprecated export interface IProps { /** A space-delimited list of class names to pass along to a child element. */ className ? : string ; } export type Props = IProps ; deprecated export interface IIntentProps { /** Visual intent color to apply to element. */ intent ? : Intent ; } export type IntentProps = IIntentProps ; deprecated export interface IActionProps extends IntentProps , Props { /** Whether this action is non-interactive. */ disabled ? : boolean ; /** Name of a Blueprint UI icon (or an icon element) to render before the text. */ icon ? : IconName | MaybeElement ; /** Click event handler. */ onClick ? : ( event : React . MouseEvent < HTMLElement > ) => void ; /** Action text. Can be any single React renderable. */ text ? : React . ReactNode ; } export type ActionProps = IActionProps ; deprecated export interface ILinkProps { /** Link URL. */ href ? : string ; /** Link target attribute. Use `"_blank"` to open in a new window. */ target ? : string ; } export type LinkProps = ILinkProps ; deprecated export interface IControlledProps { /** Initial value of the input, for uncontrolled usage. */ defaultValue ? : string ; /** Change event handler. Use `event.target.value` for new value. */ onChange ? : React . FormEventHandler < HTMLElement > ; /** Form value of the input, for controlled usage. */ value ? : string ; } export interface IControlledProps2 { /** Initial value of the input, for uncontrolled usage. */ defaultValue ? : string ; /** Form value of the input, for controlled usage. */ value ? : string ; } export type ControlledProps2 = IControlledProps2 ; deprecated export interface IElementRefProps < E extends HTMLElement > { /** A ref handler or a ref object that receives the native HTML element rendered by this component. */ elementRef ? : IRef < E > ; } deprecated export interface IOptionProps extends Props { /** Whether this option is non-interactive. */ disabled ? : boolean ; /** Label text for this option. If omitted, `value` is used as the label. */ label ? : string ; /** Value of this option. */ value : string | number ; } export type OptionProps = IOptionProps ; /** A collection of curated prop keys used across our Components which are not valid HTMLElement props. */ const INVALID_PROPS = [ "active" , "alignText" , "asyncControl" , "containerRef" , "current" , "elementRef" , "fill" , "icon" , "inputRef" , "intent" , "inline" , "large" , "loading" , "leftElement" , "leftIcon" , "minimal" , "onRemove" , "outlined" , "panel" , "panelClassName" , "popoverProps" , "rightElement" , "rightIcon" , "round" , "small" , "text" , ] ; param props param { string [ ] } invalidProps param { boolean } shouldMerge export function removeNonHTMLProps ( props , invalidProps = INVALID_PROPS , shouldMerge = false ) { if ( shouldMerge ) { invalidProps = invalidProps . concat ( INVALID_PROPS ) ; } return invalidProps . reduce ( ( prev , curr ) => { if ( curr . indexOf ( "-" ) !== - 1 ) { return prev ; } if ( prev . hasOwnProperty ( curr ) ) { delete ( prev as any ) [ curr ] ; } return prev ; } , { ... props } ) ; }