UNPKG

@kelvininc/ui-components

Version:
38 lines (37 loc) 1.32 kB
import { offset, size } from "@floating-ui/dom"; import { EIconName } from "../icon/icon.types"; import { EInputFieldType, EValidationState } from "../text-field/text-field.types"; import { DEFAULT_DROPDOWN_Z_INDEX } from "../../globals/config"; // It needs to be lower because there are other dropdowns with a portal inside export const TIME_PICKER_PORTAL_Z_INDEX = DEFAULT_DROPDOWN_Z_INDEX - 1; export const TIME_RANGE_PICKER_DROPDOWN_INPUT_OFFSET = 8; export const DEFAULT_TIME_RANGE_PICKER_INPUT_CONFIG = { placeholder: 'Select a date', type: EInputFieldType.Text, icon: EIconName.Calendar, state: EValidationState.None, tooltipConfig: { truncate: false } }; export const DEFAULT_TIME_RANGE_DROPDOWN_POSITION_OPTIONS = { placement: 'bottom-end', middleware: [ offset(TIME_RANGE_PICKER_DROPDOWN_INPUT_OFFSET), size({ apply({ elements }) { Object.assign(elements.floating.style, { width: 'max-content' }); } }) ] }; export const DEFAULT_SELECTED_TIME_KEY = 'last-24-h'; export const FULL_RANGE_SIZE = 2; export const APPLY_BUTTON_ERROR_TOOLTIP_TEXT = 'Both time inputs must be filled.'; export const UTC_TIMEZONE_OFFSET = { name: 'utc', offset: 0, label: 'UTC' };