-
Notifications
You must be signed in to change notification settings - Fork 831
/
rating.ts
66 lines (62 loc) · 1.67 KB
/
rating.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {StarRating} from 'baseui/rating';
import {PropTypes} from 'react-view';
import {TConfig} from '../types';
const starRatingProps = require('!!extract-react-types-loader!../../../../src/rating/star-rating.js');
const ratingConfig: TConfig = {
imports: {
'baseui/rating': {
named: ['StarRating'],
},
},
scope: {StarRating},
theme: ['rating200', 'rating400'],
props: {
numItems: {
value: 5,
type: PropTypes.Number,
description: 'The total number of items to display.',
},
onChange: {
value: '(data) => setValue(data.value)',
type: PropTypes.Function,
description: "Callback that's called with the newly selected value.",
propHook: {
what: 'data.value',
into: 'value',
},
},
value: {
value: 4,
type: PropTypes.Number,
description: 'The current rating value.',
stateful: true,
},
overrides: {
value: undefined,
type: PropTypes.Custom,
description: 'Lets you customize all aspects of the component.',
custom: {
names: ['Root', 'Item'],
sharedProps: {
$isActive: {
type: PropTypes.Boolean,
description:
'Indicates if the item is a part of the current selection.',
},
$isSelected: {
type: PropTypes.Boolean,
description: 'Indicates if the item is currently selected.',
},
$index: {
type: PropTypes.Number,
description: 'Index of the rendered item.',
},
},
},
},
},
mapTokensToProps: {
StarRating: starRatingProps,
},
};
export default ratingConfig;