UNPKG

@intility/bifrost-react-datepicker

Version:

React detepicker for Intility's design system, Bifrost.

45 lines (44 loc) 1.84 kB
import ReactDatePickerDefaultExport, { type DatePickerProps as OriginalDatePickerProps } from "react-datepicker"; import Icon from "@intility/bifrost-react/Icon"; type IconProp = React.ComponentProps<typeof Icon>["icon"]; export type DatePickerMode = "year" | "monthYear" | "time" | "dateTime" | "date"; export type DatePickerState = "default" | "success" | "warning" | "alert"; type OmitUnion<T, K extends keyof any> = T extends any ? Omit<T, K> : never; export type DatePickerProps = OmitUnion<OriginalDatePickerProps, "icon"> & { /** Required label text */ label: React.ReactNode; /** Hide label text, will add label prop as aria-label for screen readers */ hideLabel?: boolean; /** Available states: `default`, `success`, `warning`, and `alert` */ state?: DatePickerState; /** Font Awesome icon reference (or string if using library) */ icon?: IconProp; /** Position icon on right hand side (default true) */ rightIcon?: boolean; /** Feedback text below the input field */ feedback?: React.ReactNode; /** Description text to show more information */ description?: React.ReactNode; /** Bool to mark input required, but hides the required label */ requiredNoLabel?: boolean; /** Marks input as optional */ optional?: boolean; /** Inline CSS styles */ style?: React.CSSProperties; /** Change the input size to small */ small?: boolean; }; /** * Datepicker input for use in forms * * @see https://bifrost.intility.com/react/datepicker * * @example * <DatePicker * label="Select a date" * selected={date} * onChange={(newDate) => setDate(newDate)} * /> */ export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<ReactDatePickerDefaultExport>>; export default DatePicker;