import type { MutableRefObject, ReactNode, RefCallback } from 'react'; import type { BehaviorTrackingProps } from '../../../core/types/behavior-tracking-props.js'; import type { DataTestId } from '../../../core/types/data-props.js'; import type { MaskingProps } from '../../../core/types/masking-props.js'; import type { StylingProps } from '../../../core/types/styling-props.js'; import type { NumberSpinButtonRef } from '../number-spin-button/types.js'; import type { TextSpinButtonRef } from '../text-spin-button/types.js'; /** * Props for the SpinButtonGroup component. * @internal */ export type SpinButtonGroupProps = { /** If set to `true`, a potential value overflow is applied to a succeeding spinbutton.*/ valueOverflow?: boolean; /** * Called when the user navigates backwards past the first spin button * (ArrowLeft at position 0, or Backspace with a collapsed selection at position 0). */ onLeadingEdge?: () => void; /** * Called when the user navigates forward past the last spin button * (ArrowRight at the last cursor position). */ onTrailingEdge?: () => void; /** * Called with the overflow character when a value overflow would occur at the last spin button * but there is no next sibling within the group. The originating input event is already * prevented before this callback fires. */ onTrailingOverflow?: (overflowChar: string) => void; } & StylingProps & DataTestId & MaskingProps & BehaviorTrackingProps; /** * Props for the SpinButtonGroupSeparator component. * @internal */ export type SpinButtonGroupSeparatorProps = { /** * If the trigger key is pressed on a preceding spinbutton, the first spinbutton after the separator is focused. * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values) for possible values */ trigger: string; } & StylingProps & DataTestId & BehaviorTrackingProps; /** Typed access to a potential existing child ref object. */ export type ChildWithRef = ReactNode & { ref: RefCallback | MutableRefObject | undefined; }; /** Supported types of spinbutton handlers within this hook. */ export type SpinButtonHandler = NumberSpinButtonRef | TextSpinButtonRef;