import React from "react"; import type { StyleProp, ViewStyle } from "react-native"; import type { IconNames } from "@jobber/design"; import type { XOR } from "ts-xor"; import type { ButtonSize, ButtonType, ButtonVariation } from "./types"; interface CommonButtonProps { /** * Press handler */ readonly onPress?: () => void; /** * Themes the button to the type of action it performs */ readonly variation?: ButtonVariation; /** * Sets the visual hierarchy */ readonly type?: ButtonType; /** * Defines the size of the button * * @default "base" */ readonly size?: ButtonSize; /** * Will make the button scale to take up all the available height */ readonly fullHeight?: boolean; /** * Will make the button scale to take up all of the available width */ readonly fullWidth?: boolean; /** * Makes the button un-clickable */ readonly disabled?: boolean; /** * Accessibility hint to help users understand what will happen when they press the button */ readonly accessibilityHint?: string; /** * Changes the button interface to imply loading and prevents the press callback * * @default false */ readonly loading?: boolean; /** * Adds an leading icon beside the label. */ readonly icon?: IconNames; /** * Accessibility label for the component. This is required for components that * have an `icon` but not a `label`. * * If the string is the same as the `label` prop, you don't need to add an * `accessibilityLabel`. **Don't use this for testing purposes.** */ readonly accessibilityLabel?: string; /** * Used to locate this view in end-to-end tests. */ readonly testID?: string; /** * **Use at your own risk:** Custom style for specific elements. This should only be used as a * **last resort**. Using this may result in unexpected side effects. * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components). */ readonly UNSAFE_style?: ButtonUnsafeStyle; } export interface ButtonUnsafeStyle { container?: StyleProp; contentContainer?: StyleProp; iconContainer?: StyleProp; actionLabelContainer?: StyleProp; } interface LabelButton extends CommonButtonProps { /** * Text to be displayed on the button */ readonly label: string; } interface IconButton extends CommonButtonProps { readonly icon: IconNames; readonly accessibilityLabel: string; } export type ButtonProps = XOR; export declare function Button({ label, onPress, variation, type, fullHeight, fullWidth, disabled, loading, size, accessibilityLabel, accessibilityHint, icon, testID, UNSAFE_style, }: ButtonProps): React.JSX.Element; export {};