legion-phoenix-dates
Version:
Legion UI date component
73 lines (72 loc) • 2.62 kB
TypeScript
import { GenerateConfig } from 'rc-picker/lib/generate';
import { Locale } from 'rc-picker/lib/interface';
import { PickerBaseProps as RCBaseProps, PickerDateProps as RCDateProps, PickerTimeProps as RCTimeProps } from 'rc-picker/es/Picker';
import { Dayjs } from 'dayjs';
import { RangePickerBaseProps as RCRangeBaseProps, RangePickerDateProps as RCRangeDateProps, RangePickerTimeProps as RCRangeTimeProps } from 'rc-picker/es/RangePicker';
import { PresetDate, RangeValue } from 'rc-picker/es/interface';
import { ForwardedRef, ReactNode } from 'react';
export type PickerBaseProps<DateType> = InjectDefaultProps<RCBaseProps<DateType>>;
export type PickerDateProps<DateType> = InjectDefaultProps<RCDateProps<DateType>>;
export type PickerTimeProps<DateType> = InjectDefaultProps<RCTimeProps<DateType>>;
export type DatepickerProps<DateType> = PickerBaseProps<DateType> | PickerDateProps<DateType> | PickerTimeProps<DateType>;
export type RangeBaseProps<DateType> = InjectDefaultProps<RCRangeBaseProps<DateType>>;
export type RangeDateProps<DateType> = InjectDefaultProps<RCRangeDateProps<DateType>>;
export type RangeTimeProps<DateType> = InjectDefaultProps<RCRangeTimeProps<DateType>>;
export type DateRangePickerProps<DateType> = RangeBaseProps<DateType> | RangeDateProps<DateType> | RangeTimeProps<DateType>;
export type Presets = PresetDate<Exclude<RangeValue<Dayjs>, null>>;
export type InjectDefaultProps<Props> = Omit<Props, 'locale' | 'generateConfig'> & {
generateConfig?: GenerateConfig<Dayjs>;
locale?: Locale;
/**
* Sets the icon left of the component
*/
iconLeft?: ReactNode;
/**
* Sets the size of the component
*/
size?: 'sm' | 'md' | 'lg';
/**
* Sets the variant of the component
*/
variant?: 'outline' | 'inline';
/**
* Sets the status of the component
*/
status?: 'normal' | 'error' | 'success';
/**
* Sets the block of the component
*/
block?: boolean;
/**
* Sets the disabled of the component
*/
disabled?: boolean;
/**
* Sets the hint of the component
*/
hint?: ReactNode;
/**
* Sets the message of the component
*/
message?: ReactNode;
/**
* Sets the label of the component
*/
label?: ReactNode;
/**
* Sets the id of the component
*/
id?: string;
/**
* Sets the className of the component
*/
className?: string;
/**
* Sett the padding of the component
*/
padding?: string;
/**
* Sets the margin of the component
*/
ref?: ForwardedRef<HTMLDivElement>;
};