import React from 'react'; import type { CollectionChildren, Key } from '@react-types/shared'; import { type ButtonProps } from './Button.js'; export type SplitButtonVariant = 'primary-brand' | 'primary-neutral' | 'secondary'; export interface SplitButtonProps { /** The main action's label — "Save", "Run now". */ label: string; /** The main action. */ onPress?: ButtonProps['onPress']; /** `type="submit"` makes the main action submit its form. */ type?: 'button' | 'submit'; /** * The alternatives, as MenuItems — "Save as draft", "Run with a test * input". Each is a variation on the main action, not a different one. */ children: CollectionChildren; /** An alternative was chosen, by its MenuItem `key`. */ onAction?: (key: Key) => void; /** * The menu button's name, read with the main label: "More options, Save". * Default "More options" — pass the translation. */ menuLabel?: string; /** The main action's weight. Tertiary and destructive are not offered. */ variant?: SplitButtonVariant; size?: ButtonProps['size']; startIcon?: React.ReactNode; /** Disables both halves. */ isDisabled?: boolean; /** Disables only the menu — the alternatives are unavailable, the action is not. */ isMenuDisabled?: boolean; /** MenuItem keys to disable. */ disabledKeys?: Iterable; className?: string; } /** * SplitButton — one main action, with a menu of variations on it beside: * Save, and Save as draft; Run now, and Run with a test input. * * TWO BUTTONS, TWO TAB STOPS * * The halves are separate Buttons in a `group`, not one control with a hot * zone. Each is announced and reached on its own: the main one by its label, * the menu one as "More options, Save" — its own name, then the action it * belongs to, so a page with three split buttons has three distinct menu * buttons, not three called "More options". The menu one is a MenuTrigger, * so it announces `aria-haspopup` and `aria-expanded`, and ↓ opens it. * * NOT A MENU WITH A DEFAULT. Pressing the main half does the action, always * the same one; it never becomes whichever alternative was chosen last. A * button whose meaning changes with history cannot be pressed with * confidence. */ export declare function SplitButton({ label, onPress, type, children, onAction, menuLabel, variant, size, startIcon, isDisabled, isMenuDisabled, disabledKeys, className, }: SplitButtonProps): React.JSX.Element; export declare namespace SplitButton { var displayName: string; } //# sourceMappingURL=SplitButton.d.ts.map