@itwin/core-react
Version:
A react component library of iTwin.js UI general purpose components
84 lines • 3.1 kB
TypeScript
/** @packageDocumentation
* @module Tree
*/
import "./Node.scss";
import * as React from "react";
import { Checkbox } from "@itwin/itwinui-react";
import { CheckBoxState } from "../enums/CheckBoxState.js";
import type { CommonProps } from "../utils/Props.js";
type CheckboxProps = React.ComponentPropsWithoutRef<typeof Checkbox>;
/** Props for node Checkbox renderer
* @public
* @deprecated in 4.16.0. Type is inlined in component props. Use `React.ComponentProps` type helper instead.
*/
export type NodeCheckboxRenderProps = Omit<CheckboxProps, "onChange" | "onClick"> & {
onChange: (checked: boolean) => void;
onClick: (e: React.MouseEvent) => void;
};
/** Type for node Checkbox renderer
* @public
* @deprecated in 4.16.0. Type is inlined in component props. Use `React.ComponentProps` type helper instead.
*/
export type NodeCheckboxRenderer = (props: NodeCheckboxRenderProps) => React.ReactNode;
/** Number of pixels the node gets offset per each hierarchy level
* @internal
*/
export declare const LEVEL_OFFSET = 20;
/** Properties for Tree Node CheckBox
* @public
* @deprecated in 4.15.0. Used in deprecated {@link TreeNodeProps} props.
*/
export interface NodeCheckboxProps {
/** State of the checkbox */
state?: CheckBoxState;
/** Click event callback */
onClick?: (newState: CheckBoxState) => void;
/** Indicates whether checkbox is disabled */
isDisabled?: boolean;
/** Tooltip to be displayed when mouse is hovered over checkbox */
tooltip?: string;
}
/** Properties for the [[TreeNode]] React component
* @public
* @deprecated in 4.15.0. Props of deprecated {@link TreeNode} component.
*/
export interface TreeNodeProps extends CommonProps {
label: React.ReactNode;
level: number;
icon?: React.ReactElement | string | number;
checkboxProps?: NodeCheckboxProps;
isLeaf?: boolean;
isLoading?: boolean;
isExpanded?: boolean;
isFocused?: boolean;
isSelected?: boolean;
isHoverDisabled?: boolean;
onClick?: (e: React.MouseEvent) => void;
onContextMenu?: (e: React.MouseEvent) => void;
onMouseMove?: (e: React.MouseEvent) => void;
onMouseDown?: (e: React.MouseEvent) => void;
onMouseUp?: (e: React.MouseEvent) => void;
onClickExpansionToggle?: () => void;
children?: React.ReactNode;
/** Contains render overrides for different pieces of the node component. */
renderOverrides?: {
/** Callback to render a checkbox. Only called when checkbox is displayed. */
renderCheckbox?: NodeCheckboxRenderer;
};
["data-testid"]?: string;
}
/** Presentation React component for a Tree node
* @public
* @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/tree iTwinUI Tree} instead.
*/
export declare class TreeNode extends React.Component<TreeNodeProps> {
constructor(props: TreeNodeProps);
render(): React.JSX.Element;
private createSubComponentTestId;
private _onCheckboxChange;
private _onCheckboxClick;
private _onClickExpansionToggle;
private _onClick;
}
export {};
//# sourceMappingURL=Node.d.ts.map