@chayns-components/date
Version:
A set of beautiful React components for developing your own applications with chayns.
48 lines (47 loc) • 1.43 kB
TypeScript
import { FC } from 'react';
import { HintTextPosition, type OnChange, type OnTimeAdd, type OpeningTime, type Weekday } from '../../types/openingTimes';
export type OpeningTimesProps = {
/**
* The text that should be displayed when a day is closed.
*/
closedText?: string;
/**
* If set just the current day is displayed and the whole week in a tooltip.
*/
currentDayId?: OpeningTime['id'];
/**
* Whether the opening times can be edited.
*/
editMode?: boolean;
/**
* The text that should be displayed if times are colliding.
*/
hintText?: string;
/**
* The position of the hint text.
*/
hintTextPosition?: HintTextPosition;
/**
* Function to be executed when a time is changed or a day is enabled/disabled.
* @param openingTimes
*/
onChange?: ({ time, enabledDays, dayId, isValid }: OnChange) => void;
/**
* Function to be executed when a time is added.
*/
onTimeAdd?: ({ time, dayId, isValid }: OnTimeAdd) => void;
/**
* Function to be executed when a time is removed.
*/
onTimeRemove?: (id: string) => void;
/**
* The opening times corresponding to its weekday.
*/
openingTimes: OpeningTime[];
/**
* The weekdays that should be displayed.
*/
weekdays: Weekday[];
};
declare const OpeningTimes: FC<OpeningTimesProps>;
export default OpeningTimes;