UNPKG

@ui-machines/rating

Version:

Core logic for the rating widget implemented as a state machine

23 lines (22 loc) 853 B
import { StateMachine as S } from "@ui-machines/core"; import { PropTypes, ReactPropTypes } from "@ui-machines/types"; import { MachineContext, MachineState } from "./rating.types"; export declare function connect<T extends PropTypes = ReactPropTypes>(state: S.State<MachineContext, MachineState>, send: (event: S.Event<S.AnyEventObject>) => void, normalize?: import("@ui-machines/types").NormalizeProps): { isHovering: boolean; value: number; hoveredValue: number; size: number; getRatingState: (index: number) => { isEqual: boolean; isValueEmpty: boolean; isHighlighted: boolean; isHalf: boolean; isChecked: boolean; }; inputProps: T["input"]; labelProps: T["element"]; rootProps: T["element"]; getRatingProps({ index }: { index: number; }): T["element"]; };