UNPKG

tango-ui-cw

Version:

A lightweight ui library with ClayW

50 lines (43 loc) 1.48 kB
import type { CSSProperties, HTMLAttributes } from "react"; import type { SxValue } from "../CSSFab"; export type DatePickerSize = "small" | "medium" | "large"; export type DatePickerI18nKey = "placeholder" | "placeholderTime" | "timeLabel" | "confirm" | "cancel" | "prevMonth" | "nextMonth" | (string & {}); export type DatePickerLocaleText = Partial<{ placeholder: string; placeholderTime: string; timeLabel: string; confirm: string; cancel: string; prevMonth: string; nextMonth: string; weekDays: string[]; monthFormat: string; }>; export interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, "style" | "className" | "onChange"> { /** 受控值(YYYY-MM-DD 或 YYYY-MM-DD HH:mm) */ value?: string; /** 非受控默认值 */ defaultValue?: string; /** 日期变化回调:(formatted, raw) => void */ onChange?: (formatted: string, raw: string) => void; /** 是否禁用 */ disabled?: boolean; /** 是否显示时间选择 */ time?: boolean; /** 尺寸变体 */ size?: DatePickerSize; /** Style extension via CSSFab sx */ sx?: SxValue; style?: CSSProperties; className?: string; /** i18n key */ i18nKey?: DatePickerI18nKey; /** 覆盖 locale 文案 */ localeText?: DatePickerLocaleText; /** 输入框占位文本,优先级高于 i18n / localeText */ placeholder?: string; } declare function DatePicker(props: DatePickerProps): JSX.Element; export { DatePicker }; export default DatePicker;