-
Notifications
You must be signed in to change notification settings - Fork 831
/
timepicker.ts
81 lines (78 loc) · 2.4 KB
/
timepicker.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import {TimePicker} from 'baseui/timepicker';
import {PropTypes} from 'react-view';
import {TConfig} from '../types';
import inputConfig from './input';
import selectConfig from './select';
const timepickerProps = require('!!extract-react-types-loader!../../../../src/timepicker/timepicker.js');
const TimepickerConfig: TConfig = {
imports: {
'baseui/timepicker': {named: ['TimePicker']},
},
scope: {
TimePicker,
},
theme: selectConfig.theme,
props: {
value: {
value: new Date().toISOString(),
type: PropTypes.Date,
description:
'Optional value that can be provided to fully control the component. If not provided, TimePicker will manage state internally and default to the closest step to new Date().',
stateful: true,
},
onChange: {
value: 'date => setValue(date)',
type: PropTypes.Function,
description: 'Callback for when time selection changes.',
propHook: {
what: 'date.toISOString()',
into: 'value',
},
},
creatable: {
value: undefined,
type: PropTypes.Boolean,
description: `Set to true to allow times that aren't displayed in the options list to be entered manually. Defaults to false.`,
},
nullable: {
value: undefined,
type: PropTypes.Boolean,
description: `Set to true to allow the timepicker to have an undefined value. Defaults to false.`,
},
placeholder: {
value: undefined,
type: PropTypes.String,
description: `If the value is undefined, the placeholder is shown. Defaults to HH:mm.`,
},
disabled: inputConfig.props.disabled,
format: {
value: undefined,
type: PropTypes.String,
placeholder: '12',
description:
'12 or 24. Render options in AM/PM format or 24 hour format. Defaults to 12 hour.',
},
step: {
value: undefined,
type: PropTypes.Number,
placeholder: '900',
description:
'Amount of seconds between each option time. Defaults to 900 (15 minutes).',
},
error: inputConfig.props.error,
positive: inputConfig.props.positive,
overrides: {
value: undefined,
type: PropTypes.Custom,
description: 'Lets you customize all aspects of the component.',
custom: {
names: [],
sharedProps: {},
},
},
},
mapTokensToProps: {
TimePicker: timepickerProps,
},
};
export default TimepickerConfig;