DefinitelyTyped/types/react-star-rating-component/index.d.ts
Cody Sand 3e8e17c51b add types for react-star-rating-component (#29713)
* add types for react-star-rating-component

* react-star-rating-component: set TS version to 2.8 to match react.

* use ES-style export and update tsconfig to allow `esModuleInterop`
2018-10-15 13:25:39 -07:00

54 lines
1.4 KiB
TypeScript

// Type definitions for react-star-rating-component 1.4
// Project: https://github.com/voronianski/react-star-rating-component#readme
// Definitions by: Cody Sand <https://github.com/marpstar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
interface StarRatingComponentProps {
/** name of the radio input */
name: string;
/** the value of the star rating to display. i.e. the number of filled stars */
value: number;
/** number of icons in rating, default `5` */
starCount?: number;
onStarClick?: (nextValue: number, prevValue: number, name: string) => void;
onStarHover?: (nextValue: number, prevValue: number, name: string) => void;
onStarHoverOut?: (nextValue: number, prevValue: number, name: string) => void;
/** render method for the full-star icon */
renderStarIcon?: (
nextValue: number,
prevValue: number,
name: string
) => React.ReactNode | string;
/** render method for the half-star icon */
renderStarIconHalf?: (
nextValue: number,
prevValue: number,
name: string
) => React.ReactNode | string;
/** color of selected icons */
starColor?: string;
/** color of non-selected icons */
emptyStarColor?: string;
/** is component available for editing, default `true` */
editing?: boolean;
}
declare class StarRatingComponent extends React.Component<
StarRatingComponentProps
> {}
export = StarRatingComponent;