import * as React from "react"; import { cx } from "@emotion/css"; import FocusStyleManager from "../../shared/components/FocusStyleManager"; import { IconShapes } from "../../icon/components/Icon"; import IconPropAdapter from "../../icon/components/IconPropAdapter"; import { buttonReset, textWeight, flex, flexItem, display, padding } from "../../shared/styles/styleUtils"; import { button, buttonBase, buttonInverse, fullWidthButton, focusStyleByAppearance, getInverseMutedButtonStyles, getMutedButtonStyles, processingTextStyle } from "../style"; import { LinkProps } from "../../link/types"; import UnstyledLink from "../../link/components/UnstyledLink"; export enum ButtonAppearances { Primary = "primary", Secondary = "secondary", Standard = "standard", Danger = "danger", Success = "success" } export interface ButtonProps extends LinkProps { /** * if the button triggers new content to appear (e.g.: modals and dropdowns) */ ariaHaspopup?: boolean; /** * should be used if the button does not contain text children. For example: a button that is just an icon */ ariaLabel?: string; children?: React.ReactNode | string; /** * whether or not the button is enabled */ disabled?: boolean; /** * the icon that appears before the button text */ // TODO: only accept IconShapes when we make a big breaking change iconStart?: IconShapes | React.ReactElement; /** * the icon that appears after the button text */ // TODO: only accept IconShapes when we make a big breaking change iconEnd?: IconShapes | React.ReactElement; /** * whether the action the button was meant to do has completed */ isProcessing?: boolean; /** * if the button should fill the width of it's container */ isFullWidth?: boolean; /** * if the button is on a dark background */ isInverse?: boolean; /** * the function that is called when the button loses focus */ onBlur?: (e?: React.SyntheticEvent) => void; /** * the function that is called when the button gets focus */ onFocus?: (e?: React.SyntheticEvent) => void; /** * the function that is called when the button is "clicked" via cursor, touch, or keyboard */ onClick?: (e?: React.SyntheticEvent) => void; /** * the type of button - same as HTML "type" attribute on the ); } ); const ButtonBase = (props: ButtonBaseProps) => { return ( ); }; export default React.memo(ButtonBase);