1 | import * as React from 'react'
|
2 | import { Dimensions, Theme, Box, BoxAlign } from '@nivo/core'
|
3 | import { LegendProps } from '@nivo/legends'
|
4 |
|
5 | declare module '@nivo/calendar' {
|
6 | export type DateOrString = string | Date
|
7 |
|
8 | export interface CalendarDatum {
|
9 | day: string
|
10 | value: number
|
11 | }
|
12 |
|
13 | export interface CalendarData {
|
14 | from: DateOrString
|
15 | to: DateOrString
|
16 | data: CalendarDatum[]
|
17 | }
|
18 |
|
19 | export type CalendarDirection = 'horizontal' | 'vertical'
|
20 |
|
21 | export type CalendarLegend = LegendProps & {
|
22 | itemCount: number
|
23 | }
|
24 |
|
25 | export interface CalendarDayData {
|
26 | date: Date
|
27 | day: string
|
28 | value?: number
|
29 | color: string
|
30 | size: number
|
31 | x: number
|
32 | y: number
|
33 | }
|
34 |
|
35 | export type CalendarCommonProps = Partial<{
|
36 | minValue: 'auto' | number
|
37 | maxValue: 'auto' | number
|
38 |
|
39 | direction: CalendarDirection
|
40 | colors: string[]
|
41 | margin: Box
|
42 | align: BoxAlign
|
43 |
|
44 | yearLegend: (year: number) => string | number
|
45 | yearSpacing: number
|
46 | yearLegendOffset: number
|
47 |
|
48 | monthLegend: (year: number, month: number, date: Date) => string | number
|
49 | monthBorderWidth: number
|
50 | monthBorderColor: string
|
51 | monthLegendOffset: number
|
52 |
|
53 | daySpacing: number
|
54 | dayBorderWidth: number
|
55 | dayBorderColor: string
|
56 | emptyColor: string
|
57 |
|
58 | isInteractive: boolean
|
59 |
|
60 | tooltipFormat: (value: number) => string | number
|
61 | tooltip: React.StatelessComponent<CalendarDayData>
|
62 |
|
63 | legends: CalendarLegend[]
|
64 |
|
65 | theme: Theme
|
66 | }>
|
67 |
|
68 | export type CalendarSvgProps = CalendarData &
|
69 | CalendarCommonProps &
|
70 | Partial<{
|
71 | onClick: (datum: CalendarDayData, event: React.MouseEvent<SVGRectElement>) => void
|
72 | }>
|
73 |
|
74 | export class Calendar extends React.Component<CalendarSvgProps & Dimensions> {}
|
75 | export class ResponsiveCalendar extends React.Component<CalendarSvgProps> {}
|
76 | }
|