defaultContextValues.ts
1.22 KB
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
import { enUS } from 'date-fns/locale';
import { CaptionLayout } from 'components/Caption';
import { DayPickerContextValue } from 'contexts/DayPicker';
import { defaultClassNames } from './defaultClassNames';
import * as formatters from './formatters';
import * as labels from './labels';
export type DefaultContextProps =
| 'captionLayout'
| 'classNames'
| 'formatters'
| 'locale'
| 'labels'
| 'modifiersClassNames'
| 'modifiers'
| 'numberOfMonths'
| 'styles'
| 'today'
| 'mode';
export type DefaultContextValues = Pick<
DayPickerContextValue,
DefaultContextProps
>;
/**
* Returns the default values to use in the DayPickerContext, in case they are
* not passed down with the DayPicker initial props.
*/
export function getDefaultContextValues(): DefaultContextValues {
const captionLayout: CaptionLayout = 'buttons';
const classNames = defaultClassNames;
const locale = enUS;
const modifiersClassNames = {};
const modifiers = {};
const numberOfMonths = 1;
const styles = {};
const today = new Date();
return {
captionLayout,
classNames,
formatters,
labels,
locale,
modifiersClassNames,
modifiers,
numberOfMonths,
styles,
today,
mode: 'default'
};
}