import { PropsWithChildren, type ComponentRef, type ForwardRefExoticComponent, type RefAttributes } from 'react'; import { StyledProp, StyledProps, SvgStyle } from '@mapples/style'; import { PressableProps, TextStyle, View } from 'react-native'; import { ButtonVariant, ControlSize, Tone } from '../../../tokens'; /** * Props for the Button component. * * @public */ export interface ButtonProps extends PressableProps { /** The text label to display on the button */ label?: string; /** Styling configuration for the button and its typography */ styled?: StyledProps & { /** Typography-specific styling for the button label */ styleTypography?: StyledProp; /** Glyph styling for the leading/trailing icons (themed variants) */ styleIcon?: StyledProp; }; /** Typography variant to apply to the button label */ typographyVariant?: string; /** * Themed appearance. Unset renders the bare pressable exactly as before — * the label takes the typography document's colour and every colour comes * from `styled`. Set, the button paints itself from the project theme: * `filled` (tone fill), `tonal` (tinted container), `outlined`, `text` and * `elevated` (surface + shadow). */ variant?: ButtonVariant; /** Control size (themed variants): `sm` 36, `md` 44, `lg` 52 points tall. */ size?: ControlSize; /** Colour role of the themed variants. Defaults to `primary`. */ tone?: Tone; /** Glyph shown before the label (project icon family). */ leadingIconName?: string; /** Glyph shown after the label (project icon family). */ trailingIconName?: string; /** Shows an activity indicator in place of the leading glyph and ignores presses. */ loading?: boolean; /** Stretches the button across its parent (themed variants). */ fullWidth?: boolean; } /** * A customizable button component with built-in styling support. * * Without `variant` the Button is React Native's Pressable plus a label — * every colour comes from `styled`. With `variant` it is a themed control: * the fill, label colour, outline and elevation follow the project theme and * the chosen `tone`, `size` sets the height and label scale, and glyphs, * loading and disabled states are built in. Author styles in `styled` still * override every part. * * @example * ```tsx *