import { type GestureResponderEvent } from "react-native"; import { type ColorTokens, type StyleProp, type ViewStyle, type TextStyle } from "../../style/index.js"; import { type IconName } from "../icon/icon.js"; export type Kind = "segmented" | "split" | "stepper" | "spaced"; export type Size = "small" | "default" | "large"; /** A segment: a bare label, or a label paired with a kit icon glyph rendered * before it (or alone, under the group-level `iconsOnly`, where the label * becomes the segment's accessible name). Strings stay fully supported. */ export type ButtonGroupItem = string | { label: string; icon?: IconName; }; export type IconColor = "primary" | "primaryForeground" | "muted" | "foreground"; export interface ButtonGroupSkin { /** Optional gray track wrapping the segmented row (iOS); null = bare row. */ segmentedWrap: (t: ColorTokens) => ViewStyle | null; /** Border width on each segment cell (0 on iOS/Android, 1 on web). */ segmentBorderWidth: number; /** Corner radii for an attached segment given its position in the row. */ joinCorners: (index: number, count: number) => ViewStyle; /** Corner radii for a detached (spaced) peer. */ spacedCorners: ViewStyle; /** Shared-border overlap applied to every non-leading segment; null = none. */ overlap: ViewStyle | null; /** Optional leading divider on every non-leading segment (Android stadium). */ segmentDivider?: (t: ColorTokens) => ViewStyle; /** Selected vs. unselected segment fill/border. */ segmentSurface: (t: ColorTokens, selected: boolean) => ViewStyle; /** Segment label color/weight for selected vs. unselected. */ segmentLabel: (t: ColorTokens, selected: boolean) => TextStyle; /** Segment icon glyph color (the semantic Icon boolean axis) for selected vs. * unselected, tracking each skin's segmentLabel treatment. */ segmentIconColor: (selected: boolean) => IconColor; /** Show a leading check glyph on the selected segment (Android M3). */ showSelectedCheck: boolean; splitPrimary: (t: ColorTokens) => ViewStyle; splitPrimaryLabel: (t: ColorTokens) => TextStyle; splitDivider: (t: ColorTokens, height: number) => ViewStyle; splitTrigger: (t: ColorTokens, height: number) => ViewStyle; splitChevronColor: IconColor; splitMenu: (t: ColorTokens) => ViewStyle; splitMenuItemPressed: (t: ColorTokens) => ViewStyle; splitMenuText: (t: ColorTokens) => TextStyle; stepperArrow: (t: ColorTokens, height: number) => ViewStyle; stepperArrowLeft: ViewStyle; stepperArrowRight: ViewStyle; stepperMiddle: (t: ColorTokens) => ViewStyle; stepperLabel: (t: ColorTokens) => TextStyle; stepperChevronColor: IconColor; /** iOS/web dim the cell on press; Android uses a ripple instead (null). */ pressedOpacity: number | null; /** Android ripple over a pressed cell; null on iOS/web. */ ripple?: (t: ColorTokens) => { color: string; borderless: boolean; }; } export interface ButtonGroupProps { /** Segments for segmented/spaced: a label string, or `{ label, icon }` for a * leading kit glyph. The stepper cycles the labels (icons ignored there). */ items?: ButtonGroupItem[]; /** Selected segment index (segmented, CONTROLLED), or the stepper's initial index. Omit for uncontrolled use. */ active?: number; /** Initial selected segment index for uncontrolled use (a bare segmented control selects on press). */ defaultActive?: number; /** Called with the pressed/selected index and item (and, for the stepper, the new index). */ onSelect?: (index: number, item: string, event: GestureResponderEvent) => void; segmented?: boolean; split?: boolean; stepper?: boolean; spaced?: boolean; /** Related actions shown in the split kind's chevron dropdown. */ menu?: string[]; small?: boolean; large?: boolean; /** * Segmented/spaced only: each segment renders its `icon` alone and the item's * `label` becomes the segment's ACCESSIBLE name (an icon-only view or * form-factor switcher). An item without an icon keeps its visible label, * with a dev-only warning. Split and stepper ignore it (dev-only warning). */ iconsOnly?: boolean; /** Accessible name for the segmented row (the `tablist`), announcing what * the group switches (e.g. "Preview form factor"). Segmented kind only: * spaced peers are independent buttons with no group role. */ accessibilityLabel?: string; /** * Stretch the group to the container width, the segments sharing the space * equally. An orthogonal layout modifier for the segmented and spaced kinds; * split and stepper ignore it (their cells are fixed-width chrome) with a * dev-only warning. */ block?: boolean; disabled?: boolean; /** E2E hook forwarded to the root element. */ testID?: string; /** Outer layout composition only (width/flex within a parent), never a restyle hook. */ style?: StyleProp; } /** Build a ButtonGroup component from a platform skin. */ export declare function createButtonGroup(skin: ButtonGroupSkin): (props: ButtonGroupProps) => import("react").JSX.Element; //# sourceMappingURL=button-group.shared.d.ts.map