import React, { SyntheticEvent, ReactElement } from 'react'; import Advanced, { AdvancedInputType, possibleAdvancedInputTypes } from './Advanced'; import DateRange from './DateRange'; import DateTimeRange from './DateTimeRange'; import { PanelType, ParseTimeResult } from './Panel'; import Presets from './Presets'; import RealTime from './RealTime'; import Relative from './Relative'; import type { Preset } from './types'; export declare enum FormInputType { relative = "relative", realTime = "realTime", date = "date", dateTime = "dateTime" } export type MomentTimeZone = { name: string; }; export interface TimeRangeProps { /** * An array of types of input allowed in the Advanced panel. * Defaults to ['realTime', 'relative', 'allTime', 'dateTime']. */ advancedInputTypes?: AdvancedInputType[]; /** * If provided, children will be rendered in place of the default panels. * These must be one or more of the following: TimeRangeDialog.Relative, TimeRangeDialog.RealTime, TimeRangeDialog.DateRange, * TimeRangeDialog.DateTimeRange, TimeRangeDialog.Advanced, TimeRangeDialog.Presets. */ children?: React.ReactNode; /** * The id of the description. When placed in a ControlGroup, this automatically set to the * ControlGroup's help component. */ describedBy?: string; /** * A URL for the documentation link in the Advanced Panel. */ documentationURL?: string; /** * Earliest limit for search * Default value is '0' (beginning of epoch) */ earliest: string; /** * An array of types of input allowed in the forms. Removing a value will disable * the related panel. Defaults to ['realTime', 'relative', 'date', 'dateTime']. */ formInputTypes?: FormInputType[]; /** Make the control an inline block with variable width. */ inline?: boolean; /** * Latest limit for search * Default value is 'now' */ latest: string; /** * A callback to receive the change events. * If value is set, this callback is required. This must set the value prop to retain the * change. The callback is passed an object with two properties: 'earliest' and 'latest'. */ onChange?: (e: SyntheticEvent, data?: any) => void; /** * A callback to passed a time string. This function must update the parseEarliest prop. This * function is required when not using the SplunkwebConnector. */ onRequestParseEarliest?: (time: string, panelId?: string) => void; /** * A callback to passed a time string. This function must update the parseLatest prop. This * function is required when not using the SplunkwebConnector. */ onRequestParseLatest?: (time: string, panelId?: string) => void; /** * The parseEarliest is used to preview earliest times and validate form data. The `time` * value must be the time string passed to the onRequestParseEarliest function. Example * return format: * ``` * { * error: null, * iso: '2017-05-08T00:00:00.000', * time: '-7d' * } * ``` */ parseEarliest?: ParseTimeResult; /** * The parseLatest is used to preview latest times and validate form data. The `time` * value must be the time string passed to the onRequestParseLatest function. Example * return format: * ``` * { * error: null, * iso: '2017-05-08T00:00:00.000', * time: '-7d' * } * ``` */ parseLatest?: ParseTimeResult; placeholder?: string; /** * A definition of the presets. The time util can be used to inpect and filter certain * types of time ranges before setting this prop. This property is required to display the * presets panel when not using the SplunkwebConnector. */ presets?: Preset[]; /** Prevents user from accessing RealTime panel and RealTime presets. */ realTimeDisabled?: boolean; /** * Styles to place on the wrapper. */ style?: { [key: string]: any; }; /** * A moment Time Zone object in Unpacked format (https://momentjs.com/timezone/docs/#/data-formats/unpacked-format/). * It is used to set the Time Zone of the Time Range Dialog Component. */ momentTimeZone?: MomentTimeZone; } export declare const possibleFormInputTypes: FormInputType[]; export declare const findPanelType: ({ advancedInputTypes, earliest, formInputTypes, latest, presets, }: Pick) => PanelType; export declare const convertToISO: (time: string, parse: ParseTimeResult, isEarliest?: boolean) => string; export declare function enrichParse(parse: ParseTimeResult): ParseTimeResult; type TimeRangeDialogComponent = ((props: TimeRangeProps) => ReactElement) & { Advanced: typeof Advanced; DateRange: typeof DateRange; DateTimeRange: typeof DateTimeRange; Presets: typeof Presets; RealTime: typeof RealTime; Relative: typeof Relative; }; declare const TimeRangeDialog: TimeRangeDialogComponent; export default TimeRangeDialog; export { AdvancedInputType, possibleAdvancedInputTypes };