UNPKG

@r365/react-calendar-timeline

Version:
35 lines (34 loc) 1.49 kB
import React, { PropsWithChildren } from 'react'; import { SelectUnits } from '../utility/calendar'; import { TimelineContext as TimelineContextValue, TimelineDate } from '../types/main'; export declare const TimelineContext: React.Context<TimelineContextType>; type TimelineStartProps = { visibleTimeStart: number; visibleTimeEnd: number; canvasTimeStart: number; canvasTimeEnd: number; canvasWidth: number; showPeriod: (from: TimelineDate, to: TimelineDate) => void; timelineUnit: SelectUnits; timelineWidth: number; timezone: string; }; export type TimelineContextType = { getTimelineState: () => TimelineContextValue; getLeftOffsetFromDate: (date: number) => number; getDateFromLeftOffsetPosition: (leftOffset: number) => number; showPeriod: (from: TimelineDate, to: TimelineDate) => void; }; type TimelineState = { timelineContext: TimelineContextType; }; export declare class TimelineStateProvider extends React.Component<PropsWithChildren<TimelineStartProps>, TimelineState> { constructor(props: PropsWithChildren<TimelineStartProps>); getTimelineState: () => TimelineContextValue; getLeftOffsetFromDate: (date: number) => number; getDateFromLeftOffsetPosition: (leftOffset: number) => number; render(): import("react/jsx-runtime").JSX.Element; } export declare const TimelineStateConsumer: React.Consumer<TimelineContextType>; export declare const useTimelineState: () => TimelineContextType; export {};