import { type AriaDisabledProps, type DataTestId, type MaskingProps, type StylingProps } from '@dynatrace/strato-components/core'; import type { FormControlProps } from '../../core/types/form-control-props.js'; import type { TimeValue } from '../../core/types/time.js'; /** * Determines what datetime parts to show. * @public */ export type DateTimePickerType = 'time' | 'date' | 'datetime'; /** * Determines the level of precision of the time component. * @public */ export type DateTimePickerPrecision = 'minutes' | 'seconds' | 'milliseconds'; /** * Props to define what datetime parts should be shown. * @public */ export type DateTimePickerTypeProps = { type: Extract; precision?: never; } | { type?: Exclude; precision?: DateTimePickerPrecision; }; /** * @public */ export type DateTimePickerProps = FormControlProps void> & StylingProps & DataTestId & MaskingProps & DateTimePickerTypeProps & { /** * Earliest allowed ISOString and timestamp for validation. */ min?: string; /** * Latest allowed ISOString for validation. */ max?: string; /** * The placeholder that's shown in the input field if the content is empty. */ placeholder?: string; }; /** * Props or the DateSelector component. * @internal */ export interface DateSelectorProps extends StylingProps, DataTestId, MaskingProps, AriaDisabledProps { /** ISO string to initialize the calendar widget when opened. */ value: string; /** Returns the selected ISO datetime selected in the calendar widget. */ onChange: (isoDate: string) => void; /** Determine if the trigger is disabled or not. */ disabled: boolean; /** Determine if the trigger is in error state or not. */ error: boolean; /** Determines whether the input is in read-only mode. */ readOnly?: boolean; /** Earliest allowed ISOString and timestamp for validation. */ min?: string; /** Latest allowed ISOString for validation. */ max?: string; /** * The precision of the time shown in the display value. * @defaultValue 'minutes' */ precision?: 'minutes' | 'seconds' | 'milliseconds'; } /** * Imperative handle to provide methods to interact with the calendar widget. * @internal */ export interface DateSelectorRef { /** Open the calendar widget. */ open(): void; /** Close the calendar widget. */ close(): void; }