@kelvininc/ui-components
Version:
Kelvin UI Components
98 lines (97 loc) • 4.06 kB
JavaScript
/**
* Relative time range keys for predefined time periods.
*
* @remarks
* These keys are used to define standard time ranges in the time picker component.
* Each key has a corresponding configuration in `RELATIVE_TIME_OFFSETS`.
*
* @example
* ```typescript
* import { ERelativeTimeRangeKey, getRelativeTimeCalculation } from '@kelvininc/ui-components';
*
* const config = getRelativeTimeCalculation(ERelativeTimeRangeKey.Last_24_H);
* // Returns: { amount: -24, unit: 'hours' }
* ```
*/
export var ERelativeTimeRangeKey;
(function (ERelativeTimeRangeKey) {
// Minutes - Past
ERelativeTimeRangeKey["Last_5_m"] = "last-5-m";
ERelativeTimeRangeKey["Last_10_m"] = "last-10-m";
ERelativeTimeRangeKey["Last_15_m"] = "last-15-m";
ERelativeTimeRangeKey["Last_30_m"] = "last-30-m";
// Hours - Past
ERelativeTimeRangeKey["Last_1_H"] = "last-1-h";
ERelativeTimeRangeKey["Last_3_H"] = "last-3-h";
ERelativeTimeRangeKey["Last_6_H"] = "last-6-h";
ERelativeTimeRangeKey["Last_12_H"] = "last-12-h";
ERelativeTimeRangeKey["Last_24_H"] = "last-24-h";
ERelativeTimeRangeKey["Last_48_H"] = "last-48-h";
ERelativeTimeRangeKey["Last_72_H"] = "last-72-h";
// Days - Past
ERelativeTimeRangeKey["Last_3_D"] = "last-3-d";
ERelativeTimeRangeKey["Last_7_D"] = "last-7-d";
ERelativeTimeRangeKey["Last_14_D"] = "last-14-d";
ERelativeTimeRangeKey["Last_30_D"] = "last-30-d";
ERelativeTimeRangeKey["Last_90_D"] = "last-90-d";
ERelativeTimeRangeKey["Last_365_D"] = "last-365-d";
// Months - Past
ERelativeTimeRangeKey["Last_1_M"] = "last-1-M";
ERelativeTimeRangeKey["Last_6_M"] = "last-6-M";
// Years - Past
ERelativeTimeRangeKey["Last_1_Y"] = "last-1-y";
ERelativeTimeRangeKey["Last_2_Y"] = "last-2-y";
ERelativeTimeRangeKey["Last_5_Y"] = "last-5-y";
// Special - Unit-based references
ERelativeTimeRangeKey["Today"] = "today";
ERelativeTimeRangeKey["Yesterday"] = "yesterday";
ERelativeTimeRangeKey["Yesterday_End"] = "yesterday-end";
// "So far" ranges (from start of unit to now)
ERelativeTimeRangeKey["This_Week_So_Far"] = "this-week-so-far";
ERelativeTimeRangeKey["This_Month_So_Far"] = "this-month-so-far";
ERelativeTimeRangeKey["This_Quarter_So_Far"] = "this-quarter-so-far";
ERelativeTimeRangeKey["This_Year_So_Far"] = "this-year-so-far";
// Minutes - Future
ERelativeTimeRangeKey["Next_5_M"] = "next-5-m";
ERelativeTimeRangeKey["Next_10_M"] = "next-10-m";
ERelativeTimeRangeKey["Next_15_M"] = "next-15-m";
ERelativeTimeRangeKey["Next_30_M"] = "next-30-m";
// Hours - Future
ERelativeTimeRangeKey["Next_1_H"] = "next-1-h";
ERelativeTimeRangeKey["Next_6_H"] = "next-6-h";
ERelativeTimeRangeKey["Next_12_H"] = "next-12-h";
ERelativeTimeRangeKey["Next_24_H"] = "next-24-h";
ERelativeTimeRangeKey["Next_48_H"] = "next-48-h";
ERelativeTimeRangeKey["Next_72_H"] = "next-72-h";
// Days - Future
ERelativeTimeRangeKey["Next_7_D"] = "next-7-d";
// Weeks - Future
ERelativeTimeRangeKey["Next_2_W"] = "next-2-w";
// Months - Future
ERelativeTimeRangeKey["Next_1_M"] = "next-1-m";
})(ERelativeTimeRangeKey || (ERelativeTimeRangeKey = {}));
/**
* Unit reference for relative time calculations.
* Defines whether to align to the start or end of a time unit.
*
* @example
* ```typescript
* // "Today" starts at the beginning of the current day
* { amount: 0, unit: 'day', unitReference: EUnitReference.StartOfUnit }
*
* // "End of yesterday" aligns to the end of the previous day
* { amount: -1, unit: 'day', unitReference: EUnitReference.EndOfUnit }
* ```
*/
export var EUnitReference;
(function (EUnitReference) {
EUnitReference["StartOfUnit"] = "startOfUnit";
EUnitReference["EndOfUnit"] = "endOfUnit";
})(EUnitReference || (EUnitReference = {}));
/**
* Custom interval key for time range picker.
*
* @remarks
* Used to indicate that the user has selected a custom interval.
*/
export const CUSTOM_TIME_RANGE_KEY = 'customize-interval';