import "./ToolIcon.scss"; import React from "react"; type ToolIconSize = "s" | "m"; type ToolButtonBaseProps = { icon?: React.ReactNode; "aria-label": string; "aria-keyshortcuts"?: string; "data-testid"?: string; label?: string; title?: string; name?: string; id?: string; size?: ToolIconSize; keyBindingLabel?: string; showAriaLabel?: boolean; visible?: boolean; selected?: boolean; className?: string; }; type ToolButtonProps = | (ToolButtonBaseProps & { type: "button"; children?: React.ReactNode; onClick?(): void; }) | (ToolButtonBaseProps & { type: "radio"; checked: boolean; onChange?(): void; }); const DEFAULT_SIZE: ToolIconSize = "m"; export const ToolButton = React.forwardRef(function ( props: ToolButtonProps, ref, ) { const innerRef = React.useRef(null); React.useImperativeHandle(ref, () => innerRef.current); const sizeCn = `ToolIcon_size_${props.size || DEFAULT_SIZE}`; if (props.type === "button") { return ( ); } return ( ); });