packageDocumentation module import * as React from "react" ; import { Button as ITwinUI_Button } from "@itwin/itwinui-react" ; import { CommonProps } from "../utils/Props" ; public deprecated export enum ButtonSize { Default = "" , Large = "large" } public deprecated export enum ButtonType { Primary = "primary" , Blue = "blue" , Disabled = "disabled" , Hollow = "hollow" } public deprecated export interface ButtonProps extends React . ButtonHTMLAttributes < HTMLButtonElement > , CommonProps { /** Allow ID to be passed to Button */ id ? : string ; /** Default and large sizes */ size ? : ButtonSize ; /** 4 styles to tweak the content of the button */ buttonType ? : ButtonType ; /** A function to be run when the element is clicked */ onClick ? : ( ( event : React . MouseEvent < HTMLButtonElement , MouseEvent > ) => void ) ; } public deprecated export class Button extends React . PureComponent < ButtonProps > { private getIuiButtonType = ( buttonType ? ) : string => { let iuiButtonType ; switch ( buttonType ) { case ButtonType . Blue : iuiButtonType = "high-visibility" ; break ; case ButtonType . Hollow : iuiButtonType = "default" ; break ; case ButtonType . Primary : default : iuiButtonType = "cta" ; break ; } return iuiButtonType ; } ; public override render ( ) { const { buttonType , size , className , style , onClick , ... props } = this . props ; const iuiButtonType = this . getIuiButtonType ( buttonType ) ; let iuiButtonSize = "small" ; if ( size === ButtonSize . Large ) iuiButtonSize = undefined ; return < ITwinUI_Button { ... props } className = { className } style = { style } onClick = { onClick } styleType = { iuiButtonType } size = { iuiButtonSize } / > ; } } internal export function getButtonTypeClassName ( buttonType ? ) { let typeClassName ; switch ( buttonType ) { case ButtonType . Blue : typeClassName = "uicore-buttons-blue" ; break ; case ButtonType . Disabled : typeClassName = "uicore-buttons-disabled" ; break ; case ButtonType . Hollow : typeClassName = "uicore-buttons-hollow" ; break ; case ButtonType . Primary : default : typeClassName = "uicore-buttons-primary" ; break ; } return typeClassName ; }