import { type StyleProp, type ViewStyle } from 'react-native'; import { type VariantRole, type VariantRoles } from '../../core/theme/variantRoles'; import { type SizeValue } from '../../core/theme/sizes'; import type { PlatformBlocksTheme } from '../../core/theme/types'; import type { ButtonProps } from './types'; /** Maps a Button variant onto the shared color-bearing variant model. */ export declare const getCanonicalVariant: (variant: string | undefined) => VariantRole | undefined; export interface ButtonStyleParams { theme: PlatformBlocksTheme; variant: ButtonProps['variant']; size: SizeValue; disabled: boolean; loading: boolean; radiusStyles: Record; shadowStyles: Record; /** Resolved fill/border/text for the color-bearing variants; `null` for neutral ones. */ roles: VariantRoles | null; isIconButton: boolean; } /** * Visual style for the Button's Pressable — box metrics, fill, border, radius. * * @note `fullWidth` and flex are deliberately NOT handled here. The Pressable * sits two Views deep, so width/flex on it cannot grow the button inside a flex * row; see {@link splitButtonLayoutStyles}, which routes those to the outer * wrapper instead. */ export declare const getButtonStyles: ({ theme, variant, size, disabled, loading, radiusStyles, shadowStyles, roles, isIconButton, }: ButtonStyleParams) => any; /** * Resolves a color token to a concrete value. Accepts `palette`, * `palette.shade`, or a raw CSS/hex color (returned unchanged). */ export declare const resolveTokenColor: (theme: PlatformBlocksTheme, token?: string) => string | undefined; /** * Tint color for the color-bearing variants. Core palette tokens pass through * as tokens (the shared resolver does its own palette lookup); `palette.shade` * and raw CSS colors are pre-resolved to a concrete value. */ export declare const resolveRoleColor: (theme: PlatformBlocksTheme, token?: string) => string; export interface ButtonTextColorParams { theme: PlatformBlocksTheme; variant: ButtonProps['variant']; roles: VariantRoles | null; /** Explicit `textColor` prop, if any — always wins. */ textColorProp?: string; /** Whether the consumer asked for a specific tint via `color`/`colorVariant`. */ hasExplicitColor: boolean; /** Accent text color, used by ghost/link when a tint was requested. */ accentText: string; } /** Label (and icon, and loader) color for a given variant. */ export declare const resolveButtonTextColor: ({ theme, variant, roles, textColorProp, hasExplicitColor, accentText, }: ButtonTextColorParams) => string; /** * Fill/border/text for a color-bearing variant. Returns `null` for the neutral * variants (secondary, ghost, link, none), which keep their bespoke styling. */ export declare const resolveButtonRoles: (theme: PlatformBlocksTheme, canonicalVariant: VariantRole | undefined, roleColor: string, gradientStops: [string, string]) => VariantRoles | null; /** * Extra feedback layered on top of the press scale: a dip in opacity, plus a * 1px nudge downward on native (where it reads as a physical press). */ export declare const getButtonPressedStyle: (variant: ButtonProps["variant"]) => { transform?: { translateY: number; }[] | undefined; opacity: number; }; /** Accent text color used by ghost/link when the consumer requests a tint. */ export declare const resolveAccentTextColor: (theme: PlatformBlocksTheme, roleColor: string) => string; /** Gap between the label and any start/end icon. */ export declare const getButtonIconSpacing: (size: SizeValue) => number; /** Base label style, before `labelProps` is merged over it. */ export declare const getButtonLabelStyle: (size: SizeValue) => { lineHeight: number; textAlignVertical: "center"; }; export interface ButtonLayoutSplit { /** Width-family layout + hoisted flex — belongs on the outer wrapper. */ outer: Record; /** Height-family layout — belongs on the Pressable. */ pressableLayout: Record; /** Consumer `style` minus the flex props hoisted to the wrapper. */ pressableStyle: Record; } /** * Splits layout between the Button's outer wrapper and its inner Pressable. * * The Pressable is nested two Views deep, so width/flex applied to it can't * size the button within a flex row. Width-family layout (`fullWidth`/`w`/ * `maxW`/`minW`), `alignSelf`, and any flex props in the consumer's `style` go * to the outer wrapper; height-family layout and all visual style stay on the * Pressable. */ export declare const splitButtonLayoutStyles: (layoutStyles: Record, style: StyleProp) => ButtonLayoutSplit; /** * Cross-axis sizing for the Button's outer wrapper. * * Buttons hug their content by default, so `alignItems: 'flex-start'` keeps the * Pressable at its natural width. Note this constrains the *Pressable*, not the * wrapper: the wrapper still takes whatever alignment its parent gives it, so a * centering parent (``) keeps centering the button rather * than being overridden. Anything that asks the button to fill — `fullWidth`, * an explicit width, or a flex value — switches back to `stretch`. */ export declare const getButtonFillStyle: (outer: Record) => { alignItems: "flex-start" | "stretch"; };