mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
add @types/react-stars (#40725)
This commit is contained in:
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for react-stars 2.2
|
||||
// Project: https://github.com/n49/react-stars
|
||||
// Definitions by: TingYuLC <https://github.com/TingYuLC>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.6
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
interface ReactStarsProps {
|
||||
/** Name of parent class */
|
||||
className?: string;
|
||||
|
||||
/** How many total stars you want */
|
||||
count?: number;
|
||||
|
||||
/** Set rating value */
|
||||
value?: number;
|
||||
|
||||
/** Which character you want to use as a star */
|
||||
char?: string;
|
||||
|
||||
/** Color of inactive star (this supports any CSS valid value) */
|
||||
color1?: string;
|
||||
|
||||
/** Color of selected or active star */
|
||||
color2?: string;
|
||||
|
||||
/** Size of stars (in px) */
|
||||
size?: number;
|
||||
|
||||
/** Should you be able to select rating or just see rating (for reusability) */
|
||||
edit?: boolean;
|
||||
|
||||
/** Should component use half stars, if not the decimal part will be dropped otherwise normal algebra rools will apply to round to half stars */
|
||||
half?: boolean;
|
||||
|
||||
/** Will be invoked any time the rating is changed */
|
||||
onChange?: (new_rating: number) => void;
|
||||
}
|
||||
|
||||
declare class ReactStars extends React.Component<ReactStarsProps> {}
|
||||
|
||||
export default ReactStars;
|
||||
@@ -0,0 +1,17 @@
|
||||
import ReactStars from "react-stars";
|
||||
import * as React from "react";
|
||||
|
||||
const starsChange = (newVal: number) => {};
|
||||
|
||||
const Stars: JSX.Element = (
|
||||
<ReactStars
|
||||
count={5}
|
||||
value={4.5}
|
||||
color1="#E6E6E6"
|
||||
color2="#FFCC33"
|
||||
edit
|
||||
half
|
||||
size={14}
|
||||
onChange={starsChange}
|
||||
/>
|
||||
);
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"esModuleInterop": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"jsx": "react",
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-stars-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user