import type React from 'react'; import { type UIAnalyticsEvent } from '@atlaskit/analytics-next'; import { type IconProps, type NewIconProps } from '@atlaskit/icon/types'; export type ButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'warning' | 'discovery'; export type LinkButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'warning' | 'discovery'; export type IconButtonAppearance = 'default' | 'primary' | 'discovery' | 'subtle'; export type Appearance = ButtonAppearance | LinkButtonAppearance | IconButtonAppearance; export type ButtonSpacing = 'compact' | 'default'; export type IconButtonSpacing = 'compact' | 'default'; export type Spacing = ButtonSpacing | IconButtonSpacing; export type IconProp = React.ComponentType | Omit>; export type IconSize = 'small' | 'large' | 'xlarge'; type Combine = Omit & Second; export type CommonBaseProps = { /** * Set the button to autofocus on mount. */ autoFocus?: boolean; /** * Disable the button to prevent user interaction. */ isDisabled?: boolean; /** * Indicates that the button is selected. */ isSelected?: boolean; /** * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests. */ testId?: string; /** * Additional information to be included in the `context` of Atlaskit analytics events that come from button. See [the pressable or anchor primitive code examples](https://atlassian.design/components/primitives/anchor/examples#atlaskit-analytics) for more information. */ analyticsContext?: Record; /** * An optional name used to identify the button to interaction content listeners. By default, button fires React UFO (Unified Frontend Observability) press interactions for available listeners. This helps Atlassian measure performance and reliability. See [the pressable or anchor primitive code examples](https://atlassian.design/components/primitives/anchor/examples#react-ufo-press-interactions) for more information. */ interactionName?: string; }; export type CommonButtonProps = CommonBaseProps & { /** * Handler called on blur. */ onBlur?: React.FocusEventHandler; /** * Handler called on focus. */ onFocus?: React.FocusEventHandler; /** * Handler called on click. You can use the second argument to fire Atlaskit analytics events on custom channels. They could then be routed to GASv3 analytics. See the pressable or anchor primitive code examples for information on [firing Atlaskit analytics events](https://atlassian.design/components/primitives/pressable/examples#atlaskit-analytics) or [routing these to GASv3 analytics](https://atlassian.design/components/primitives/pressable/examples#gasv3-analytics). */ onClick?: (e: React.MouseEvent, analyticsEvent: UIAnalyticsEvent) => void; }; export type CommonAnchorProps = never> = CommonBaseProps & { /** * Handler called on blur. */ onBlur?: React.FocusEventHandler; /** * Handler called on focus. */ onFocus?: React.FocusEventHandler; /** * Handler called on click. You can use the second argument to fire Atlaskit analytics events on custom channels. They could then be routed to GASv3 analytics. See the pressable or anchor primitive code examples for information on [firing Atlaskit analytics events](https://atlassian.design/components/primitives/pressable/examples#atlaskit-analytics) or [routing these to GASv3 analytics](https://atlassian.design/components/primitives/pressable/examples#gasv3-analytics). */ onClick?: (e: React.MouseEvent, analyticsEvent: UIAnalyticsEvent) => void; /** * URL to navigate to. */ href?: string | RouterLinkConfig; }; type SupportedElementAttributes = React.ButtonHTMLAttributes | React.AnchorHTMLAttributes; type AdditionalHTMLElementPropsExtender = Combine, { 'data-testid'?: never; }>; /** * Common additional props for button `