UNPKG

@veracity/vui

Version:

Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.

87 lines (86 loc) 2.67 kB
import { ThemingProps } from "../theme/types.js"; import "../theme/index.js"; import { BoxProps } from "../box/box.types.js"; import "../box/index.js"; //#region src/calendar/calendar.types.d.ts interface DateRange { startDate?: Date; endDate?: Date; } type FlowDirection = 'next' | 'prev'; /** * Mode for this calendar * Should it handle from date, to date or single date mode */ type CalendarMode = 'exact' | 'from' | 'to' | 'range'; interface DefaultViewMonthProps { boundaries?: DateRange; isStartDate?: boolean; selectedDate?: Date; } interface MonthProps { boundaries?: DateRange; fixedNumberOfWeeks?: boolean; mode: CalendarMode; selectedDates?: DateRange; timeUnitMode?: TimeUnitMode; viewDate: Date; } type ItemProps = { boundary?: boolean; current?: boolean; isDisabled?: boolean; isHidden?: boolean; isToday?: boolean; isSelected?: boolean; }; /** * Single time item like day in a month, month in a year and year in multiple years */ interface TimeItem { /** item is at the edge for a range, marking either start or end of it */ boundary: boolean; /** item is clicked and selected by the user */ current: boolean; /** the actual time item */ date: Date; /** disabled because out of bounds */ isDisabled: boolean; /** item should be hidden, for days we hide days that are not in the current month, * but still are rendered due to weekDays */ isHidden: boolean; /** item is in the selected range between two dates */ isSelected: boolean; /** the date is today*/ isToday: boolean; } /** * All the date items in a view and whether next/prev button should be disabled */ interface TimeResult { items: TimeItem[]; nextDisabled: boolean; prevDisabled: boolean; } /** * Time mode for calendar, display days in month, months in year or years in multiple years */ type TimeUnitMode = 'day' | 'month' | 'year'; type CalendarProps = Omit<BoxProps, 'size' | 'variant'> & ThemingProps<'Calendar'> & { /** Allowed range to select from */ boundaries?: DateRange; className?: string; disabled?: boolean; /** Including always 6 weeks into a month (used to have stable height in the calendar) */ fixedNumberOfWeeks?: boolean; isStartDate?: boolean; /** Calendar select mode: 'exact' | 'from' | 'to' | 'range' @default 'exact' */ mode: CalendarMode; /** On selecting a day */ onSelectDates?: (value: DateRange) => void; /** Selected date */ selectedDates?: DateRange; }; //#endregion export { CalendarMode, CalendarProps, DateRange, DefaultViewMonthProps, FlowDirection, ItemProps, MonthProps, TimeItem, TimeResult, TimeUnitMode }; //# sourceMappingURL=calendar.types.d.ts.map